网友您好, 请在下方输入框内输入要搜索的题目:
题目内容
(请给出正确答案)
int i = 0; while (true) { if(i==4) { break; } ++i; } System.out.println(“i=”+i); What is the result?()
- A、 i = 0
- B、 i = 3
- C、 i = 4
- D、 i = 5
- E、 Compilation fails.
参考答案
更多 “ int i = 0; while (true) { if(i==4) { break; } ++i; } System.out.println(“i=”+i); What is the result?() A、 i = 0B、 i = 3C、 i = 4D、 i = 5E、 Compilation fails.” 相关考题
考题
下列选项中,不能输出100个整数的是A.for(int i=0;i100;i++) System.out.println(i);B.int i=0; do{ System.out.println(i); i++; }while(i100);C.int i=0; while(i100){ System.out.printIn(i); i++; }D.int i=0; while(i100){ i++; if(i100)continue; System .out.printIn(i); }
考题
下列语句中不是死循环的是A.int i=10; while(1) { i-- ; if (i= =1)break; }B.for(int i=l ;i<10;i++) { i -- ; }C.int i=0; do{ i++; }while(i >= 0);D.int i=l ; for (;;)i = i+1;
考题
下列语句中不是死循环的是A.int i=10; while(1) { i--; if(i==1) break; }B.for(int i=1;i<10;i++) { i--; }C.int i=0; do{ i++; }while(i>=0) ;D.int i=1; for(;;) i=i+1;
考题
inti=0;while(true){if(i==4){break;}++i;}System.out.println(i=”+i);Whatistheresult?()
A.i=0B.i=3C.i=4D.i=5E.Compilationfails.
考题
下列选项中,不能输出100个整数的是( )。A.for(int i=0;i100;i++) System.out.println(i);B.int i=0; do{ System.out.println(i); i++; }while(i100);C.int i=0; while(i100){ System.out.println(i); i++; }D.int i=0; while(i100){ i++; if(i100)continue; System.OUt.println(i); }
考题
int i = 1,j = 10; do{ if (ij) { continue; } j--; } while (++i 6); System.out.println(“i = “ +i+” and j = “+j); What is the result?() A、 i = 6 and j = 5B、 i = 5 and j = 5C、 i = 6 and j = 4D、 i = 5 and j = 6E、 i = 6 and j = 6
考题
public class Test { public static void add3 (Integer i) { int val = i.intValue(); val += 3; i = new Integer(val); } public static void main(String args[]) { Integer i = new Integer(0); add3(i); System.out.println(i.intValue()); } } What is the result? () A、 0B、 3C、 Compilation fails.D、 An exception is thrown at runtime.
考题
int i = 0, j = 5; tp; for (;;) { i++; for(;;) { if (i --j) { break tp; break tp; } } System.out.println(“i=” +i “,j =”+j); } What is the result?() A、 i = 1, j = 0B、 i = 1, j = 4C、 i = 3, j = 4D、 i = 3, j = 0E、 Compilation fails.
考题
int i = 0, j = 1; if ((i++ == 1) (j++ == 2)) { i = 42; } System.out.println(“i = “ + i + “, j = “ + j); What is the result?() A、 i = 1, j = 2B、 i = 1, j = 1C、 i = 42, j = 2D、 i = 42, j = 1E、 Compilation fails.
考题
class Super { public int i = 0; public Super(String text) { i = 1; } } public class Sub extends Super { public Sub(String text) { i = 2; } public static void main(String args[]) { Sub sub = new Sub(“Hello”); System.out.println(sub.i); } } What is the result?() A、 0B、 1C、 2D、 Compilation fails.
考题
public static void main(String[] args) { for (int i=0;i= 10;i++){ if( i6) break; } System.out.println(i); } What is the result?() A、 6B、 7C、 10D、 11E、 Compilation fails.F、 An exception is thrown at runtime.
考题
public class test ( public static void main(string args) { int 1= 0; while (i) { if (i==4) { break; } ++i; } } ) What is the value of i at line 10?()A、 0B、 3C、 4D、 5E、 The code will not compile.
考题
public class ForBar { public static void main(String args) { int i = 0, j = 5; tp: for (;;) { i ++; for(;;) if(i --j) break tp; } system.out.printIn(“i = ” + i + “, j = “+ j); } } What is the result? () A、 The program runs and prints “i=1, j=0”B、 The program runs and prints “i=1, j=4”C、 The program runs and prints “i=3, j=4”D、 The program runs and prints “i=3, j=0”E、 An error at line 4 causes compilation to fail.F、 An error at line 7 causes compilation to fail.
考题
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?() A、 0B、 1C、 2D、 Compilation fails.
考题
int i = 0; for (; i 4; i += 2) { System.out.print(i + “”); } System.out.println(i); What is the result?() A、 0 2 4B、 0 2 4 5C、 0 1 2 3 4D、 Compilation fails.E、 An exception is thrown at runtime.
考题
1. public class test ( 2. public static void main(string args[]) { 3. int 1= 0; 4. while (i) { 5. if (i==4) { 6. break; 7. } 8. ++i; 9. } 10. 11. } 12. ) What is the value of i at line 10?()A、 0B、 3C、 4D、 5E、 The code will not compile.
考题
int i = 1,j = 10; do { if(ij) { break; } j--; } while (++i 5); System.out.println(“i =” +i+” and j = “+j); What is the result?()A、 i = 6 and j = 5B、 i = 5 and j = 5C、 i = 6 and j = 4D、 i = 5 and j = 6E、 i = 6 and j = 6
考题
单选题int i = 0; while (true) { if(i==4) { break; } ++i; } System.out.println(“i=”+i); What is the result?()A
i = 0B
i = 3C
i = 4D
i = 5E
Compilation fails.
考题
单选题int i = 0; for (; i 4; i += 2) { System.out.print(i + “”); } System.out.println(i); What is the result?()A
0 2 4B
0 2 4 5C
0 1 2 3 4D
Compilation fails.E
An exception is thrown at runtime.
考题
单选题1. public class test ( 2. public static void main(string args[]) { 3. int 1= 0; 4. while (i) { 5. if (i==4) { 6. break; 7. } 8. ++i; 9. } 10. 11. } 12. ) What is the value of i at line 10?()A
0B
3C
4D
5E
The code will not compile.
考题
单选题public class test ( public static void main(string args) { int 1= 0; while (i) { if (i==4) { break; } ++i; } } ) What is the value of i at line 10?()A
0B
3C
4D
5E
The code will not compile.
考题
单选题int i = 0, j = 1; if ((i++ == 1) (j++ == 2)) { i = 42; } System.out.println(“i = “ + i + “, j = “ + j); What is the result?()A
i = 1, j = 2B
i = 1, j = 1C
i = 42, j = 2D
i = 42, j = 1E
Compilation fails.
考题
单选题class Super { public int i = 0; public Super(String text) { i = 1; } } public class Sub extends Super { public Sub(String text) { i = 2; } public static void main(String args[]) { Sub sub = new Sub(“Hello”); System.out.println(sub.i); } } What is the result?()A
0B
1C
2D
Compilation fails.
考题
单选题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?()A
0B
1C
2D
Compilation fails.
考题
单选题int i = 1,j = 10; do { if(ij) { break; } j--; } while (++i 5); System.out.println(“i =” +i+” and j = “+j); What is the result?()A
i = 6 and j = 5B
i = 5 and j = 5C
i = 6 and j = 4D
i = 5 and j = 6E
i = 6 and j = 6
考题
多选题int i = 0, j = 5; tp; for (;;) { i++; for(;;) { if (i --j) { break tp; break tp; } } System.out.println(“i=” +i “,j =”+j); } What is the result?()Ai = 1, j = 0Bi = 1, j = 4Ci = 3, j = 4Di = 3, j = 0ECompilation fails.
考题
单选题int i = 1,j = 10; do{ if (ij) { continue; } j--; } while (++i 6); System.out.println(“i = “ +i+” and j = “+j); What is the result?()A
i = 6 and j = 5B
i = 5 and j = 5C
i = 6 and j = 4D
i = 5 and j = 6E
i = 6 and j = 6
热门标签
最新试卷