A.跳出循环,无输出
B.0121
C.01
D.0123
第1题:
阅读下面程序
public class Test3{
public static void main(String args[]){
int x=3,y=4,z=5;
String s= " xyz " ;
System.out.println(s+x+y+z);
}
}
程序运行的结果是
A)xyz12
B)xyz345
C)xyzxyz
D)12xyz
第2题:
有如下程序 public class Sun { public static void main(String args[ ]) { int x=0; int n=0; while(x<50) { x=(x+2)*(x+3); n=n+1; } System.out.println(n+"和"+x); } } 上述程序的运行结果是( )。
A.1和0
B.2和72
C.3和50
D.4和168
第3题:
若有如下程序:
public class Test {
public static void main (String[] args) {
int x=20;
if (x>10) System.out.print(x-=5);
if (x>5) System.out.print(x--);
}
}则程序运行后的输出结果是【 】。
第4题:
下列程序的输出结果是 class Test{ public static void main(String args[]){ int n=7; n<<=3; n=n&n+1|n+2^n+3; n>>=2; System.out.println(n); } }
A.0
B.-1
C.14
D.64
第5题:
下面程序段的输出结果是( )。 public class Test t public static void main(String[] args) { int x=0; for (int i=1;i<=4;i++) { x=4; for(int j=1;j<=3; j++) { x=3; for(int k=1; k<=2; k++) x=x+6; } } System. out. println (x); } }
A.36
B.48
C.144
D.15
第6题:
下面程序的输出结果为( )。 public class Test { public static void main (String args[]) { String X="ABCD"; String Y="EFG"; X=X.substring (X.length()-Y.length()); System.out.println(X); } }
A.ABC
B.BCD
C.EFG
D.ABCDEFG
第7题:
下列程序执行后的结果为______。 public class exl2 { public static void main(string[] args) { int n=4; int x=0; do{ System.out.print(n); }while (x++<n--); } }
A.12
B.432
C.43
D.4
第8题:
运行下面的程序时,会产生( )。 public class Test{ public static void main(String args[ ] ) { int x =0; int y = 2/x; int z[ ] = {1,2,4,6}; int p=z[4]; } }
A.ArrayIndexOutOfBoundsExcePtion异常
B.NumberFormatException异常
C.ArithmeticException异常
D.ArithmeticException异常和ArrayIndexOutOfBoundsExcePtion异常
第9题:
阅读下面程序 public class Test3 { public static void main(String[] args) { int x=3,y=4,z=5; String s="xyz": System.out.println(s+x+y+z); } } 程序运行的结果是
A.xyz12
B.xyz345
C.xyzxyz
D.12xyz
第10题:
下面代码的运行结果是 public class Test{ public static void main(String args[]){ for(int i=0; i<3;i++){ if(i<2) continue; System.out.println(i); } } }
A.0
B.1
C.2
D.3