网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)

以下程序段的输出结果为( )。 int j=2 switch (j){ Case 2: system.out.print("two."): Case 2+1: System.out.println("three."); break: default: System.out.println (“value is”+j): Break }A.B.two

A.two.three.

B.two

C.three

D.value is 2


参考答案

更多 “ 以下程序段的输出结果为( )。 int j=2 switch (j){ Case 2: system.out.print("two."): Case 2+1: System.out.println("three."); break: default: System.out.println (“value is”+j): Break }A.B.twoA.two.three.B.twoC.threeD.value is 2 ” 相关考题
考题 以下程序段的输出结果为 ( )int j=2;switch(j){case 2:System.out.print("two.");case 2+1:System.out.println("three.");breakdefault:System.out.println("value is"+j);break;}A.two.three.B.two.C.three.D.value is 2

考题 以下代码的输出结果是什么? class Foo{ public static void main(String args[]){ int x=4,j=0; switch(x){ case 1:j++; case 2:j++; case 3:j++; case 4:j++; case 5:j++; break; default:j++; } System.out.println(j); } }()A.1B.2C.3D.编译错误

考题 以下程序的运行结果为?class test {public static void main(String args[]) {int i,j=0;for(i=10;iswitch(j) {case (0) : j=j+1;case ( 1、 : j=j+2; break;case ( 2、: j=j+3; break;case (10) : j=j+10; break;default : break;}System.out.println(j);}}A. 0B. 1C. 2D. 3E. 10

考题 给定程序段,求输出结果。 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);A.6B.1C.2D.4

考题 10、给定Java代码片断,如下: int i=0,j=-1; switch(i) { case 0,1:j=1; case 2:j=2; } System.out.print("j="+j); 编译运行,正确的结果是()。A.程序编译出错B.j=1C.j=2D.j=0

考题 下列程序段的输出结果是()。 int a=0; while(a<5){ switch(a){ case 0: case 3:a=a+2; case 1: case 2:a=a+3; default:a=a+5; } } System.out.print(a);A.0B.5C.10D.其他

考题 下列程序的输出结果是 for(int i=0;i<5;i++){ switch(i){ case 0:System.out.print("B"); case 1:System.out.print("e");break; case 2:System.out.print("g"); case 3:System.out.print("!");break; case 4:System.out.print("!");break; default:System.out.print("!"); } }A.Beg!!!B.Beeg!C.Beg!D.Beeg!!!

考题 4、给定程序段,求输出结果。 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);A.6B.1C.2D.4

考题 3、给定下面程序段,输出结果是()。 int i= 1, j = 0; switch(i){ case 1 : j += 6; case 2 : j += 1; default : j += 2; } System.out.println(j); A.2 B.6 C.7 D.9