下面程序的输出为( )。 public class Test { public static void main (String args[]) { int x,y; x=1; y=2; System.out.println("The output is"+x+y); } }
A: The output is xy
B: The output is 3
C: The output is 12
D: The output is x=1 y=2
A: The output is xy
B: The output is 3
C: The output is 12
D: The output is x=1 y=2
举一反三
- public class Yippee { public static void main(String [] args) { for(int x = 1; x A: No output is produced. 123 B: No output is produced. 234 C: No output is produced. 1234 D: An exception is thrown at runtime. 123 E: An exception is thrown at runtime. 234 F: An exception is thrown at rijntime. 1234
- 以下程序的输出结果为: public class test { public static void main(String args[]) { int x=1,y=1,z=1; if (x--==1&&y++==1||z++==1) System.out.println("x="+x+",y="+y+",z="+z); } }
- 设有如下程序: public class Sun { public static void main(String args[ ]) { int x,y; x=4; y=0; if(Math.pow(x,2)==16) y=x; if(Math.pow(x,2)<15) y=1/x; if(Math.pow(x,2)>15) y=(int)Math.pow(x,2)+1; System.out.println(y); } } 程序的运行结果是( )。 A: 4 B: 17 C: 18 D: 0.25
- 请阅读下面的程序 public class Test { public static void main(String[] args) { int x; int y; for (x = 1, y = 1; x <= 100; x++) { if (y >= 20) { break; } if (y % 3 == 1) { y += 3; continue; } y -= 5; } System.out.println(“x=” + x + “,y=” + y); } } 下列选项中,哪一个是程序的运行结果( )
- (6-6)请阅读程序,写出程序运行结果。 class Test{ static int x=10; int y=99; { y=y+10; } static { x=x+5; } { y=y+10; } static { x=x+5; } public Test() {//构造方法 x=x+5; } { System.out.println(x*y); } } public class Demo11 { public static void main(String[] args) { Test t1=new Test(); Test t2=new Test(); } }