It is true that j==i.
It is false that j==i.
An exception is thrown at runtime.
Compilation fails because of an error in line 13.
第1题:
下列程序执行后的结果是______。
public class ex24
{
public static void main(String[] args)
{
int j=10;
a1: for(int i=3;i>0;i--)
{
j-=i;
int m=l;
a2: while (m<j)
{
if (i<=m)
continue a1;
j/=m++;
}
}
System.out.println(j);
}
}
下列嵌套的循环程序执行后,结果是______。 public class ax25 { public static void main(String[] args) { int sum=0; for(int i=0;i<=5;i++) { for(int j=10;j>3*i;j--) { sum+=j*i; } } System.out.println(sum); } }
A.136
B.127
C.147
D.153
第2题:
控制台应用程序 example.java 如下:
public class example
{
public static void main(String[] args)
{
int i=0, j=9;
do
{
if(i++>--j) break;
} while(i<4);
System.out.println("i="+i+" and j="+j);
}
}
第3题:
下列程序输出结果为( )。 public class test { public static void main (String args[]) { int a=0; outer:for(int i=0;i<2;i + +) { for(int j=0;j<2;j+ +) { if(j>i) { continue outer; } a+ +; } } System.out.println(a); } }
A.0
B.2
C.3
D.4
第4题:
下列语句执行后,i的值是( )。 public class Test { public static void main(String[ ] args) { int i =0; for(int j=10; j>5&&i<5; j-=3,i+=2) i=i+j; System.out.println(i); } }
A.8
B.9
C.10
D.12
第5题:
11. public static void main(String[] args) { 12. Integer i = uew Integer(1) + new Integer(2); 13. switch(i) { 14. case 3: System.out.println(”three”); break; 15. default: System.out.println(”other”); break; 16. } 17. } What is the result?()
第6题:
11. public class Counter { 12. public static void main(String[] args) { 13. int numArgs = /* insert code here */; 14. } 15. } and the command line: java Counter one fred 42 Which code, inserted at line 13, captures the number of arguments passed into the program?()
第7题:
11. class Converter { 12. public static void main(String[] args) { 13. Integer i = args[0]; 14. int j = 12; 15. System.out.println(”It is “ + (j==i) + “that j==i.”); 16. } 17. } What is the result when the programmer attempts to compile the code and run it with the command java Converter 12?()
第8题:
public class Test { public static void leftshift(int i, int j) { i<<=j; } public static void main(String args[]) { int i = 4, j = 2; leftshift(i, j); System.out.printIn(i); } } What is the result?()
第9题:
public class test ( private static int j = 0; private static boolean methodB(int k) ( j += k; return true; ) public static void methodA(int i)( boolean b: b = i < 10 | methodB (4); b = i < 10 || methodB (8); ) public static void main (String args[])( methodA (0); system.out.printIn(j); ) ) What is the result?()
第10题:
0
1
2
Compilation fails.
第11题:
B
The code runs with no output.
Compilation fails because of an error in line 12.
Compilation fails because of an error in line 15.
Compilation fails because of an error in line 18.
第12题:
2
4
8
16
The code will not compile.
第13题:
下列程序输出结果为( )。public class test { public static void main(String args[]) { int a=0; outer: for(int i=0;i<2;i++) { for(int j=0;j<2;j++) { if(j>i) { continue outer; } a++; } } System.out.println(a); }}
A.0
B.2
C.3
D.4
第14题:
以下程序的输出结果为( )。 public class Main { public static void main(String[] args) { int i=0, j=0, a=6; if((++i>0)||(++j>0)) a++; System.out.println( "i=" +i+", j ="+j+", a="+A; } }
A.i=0, j=0, a=6
B.i=1, j=1, a=7
C.i=1, j=0, a=7
D.i=0, j=1, a=7
第15题:
执行下面程序后,结果是 public class Testrr { public static void main(String args[]){ int i=0xFFFFFFF1; int j=-i; System.out.println("j="+j); } }
A.j=-15
B.j=-16
C.j=16
D.j=15
第16题:
A. 0
B. 1
C. 2
D.3
第17题:
public class Test { public static void main(String Args[]) { int i =1, j = 0; switch(i) { case 2: j +=6; case 4: j +=1; default: j +=2; case 0: j +=4; } System.out.println(“j =” +j); } } What is the result? ()
第18题:
11. static class A { 12. void process() throws Exception { throw new Exception(); } 13. } 14. static class B extends A { 15. void process() { System.out.println(”B”); } 16. } 17. public static void main(String[] args) { 18. new B().process(); 19. } What is the result?()
第19题:
public class Foo { public static void main (String []args) { int i = 1; int j = i++; if ((i>++j) && (i++ ==j)) { i +=j; } } } What is the final value of i?()
第20题:
public class Test { public int aMethod() { static int i = 0; i++; return i; } public static void main (String args[]) { Test test = new Test(); test.aMethod(); int j = test.aMethod(); System.out.println(j); } } What is the result?()
第21题:
0
2
4
6
9
13
第22题:
three
other
An exception is thrown at runtime.
Compilation fails because of an error on line 12.
Compilation fails because of an error on line 13.
Compilation fails because of an error on line 15.
第23题:
It is true that j==i.
It is false that j==i.
An exception is thrown at runtime.
Compilation fails because of an error in line 13.
第24题:
The program prints “0”
The program prints “4”
The program prints “8”
The program prints “12”
The code does not complete.