class TestApp{ public static void main(String[] args){ int x = 5; switch(x){ case 1: case 2: case 3: System.out.println(“一季度”); break; case 4: case 5: case 6: System.out.println(“二季度”); case 7: case 8: case 9: System.out.println(“三季度”); break; ase 10: case 11: ase 12: System.out.println(“四季度”); break; default: System.out.println(“不是有效的月份”); } } } 上述程序运行后的结果是哪项?() A、一季度B、二季度C、三季度D、四季度
class TestApp{ public static void main(String[] args){ int x = 5; switch(x){ case 1: case 2: case 3: System.out.println(“一季度”); break; case 4: case 5: case 6: System.out.println(“二季度”); case 7: case 8: case 9: System.out.println(“三季度”); break; ase 10: case 11: ase 12: System.out.println(“四季度”); break; default: System.out.println(“不是有效的月份”); } } } 上述程序运行后的结果是哪项?()
- A、一季度
- B、二季度
- C、三季度
- D、四季度
相关考题:
下列语句序列执行后,k的值是( )。 public class c6{ public static void main(String[ ] args) { int a=10, b=18, c=30; switch (b% A) { case 7: c--; break; case 8: c-=2; break; case 9: c-=3; break; default: c* =b; break; } System.out.println (c); } }A.28B.29C.27D.30
下面程序的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int i = 9; switch (i) { default: System.out.println("default"); case 0: System.out.println("zero"); break; case 1: System.out.println("one"); case 2: System.out.println("two"); } } }A.defaunB.defauh, zeroC.error default clause not definedD.no output displayed
下面程序的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int i = 1; switch (i) { case 0: System.out.println("zero"); break; case 1: System.out.println("one"); case 2; System.out.println("two"); default: System.out.println("default"); } } }A.oneB.one,defaultC.one,two,defaultD.default
设有如下程序: import java.util.*; public class Sun { public static void main(String args[ ]) { int score; String a; Random r=new Random(); score=r.nextInt(4)+5; switch(score) { case 0: a="E"; break; case 1: a="D"; break; case 2: a="C"; break; case 3: a="B"; break; default: a="A"; } System.out.println(A) ; } } 程序运行的结果是( )。A.a="A"B.aa"E" a="A"C.a="E"D.a="C"
以下代码的输出结果是什么? 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.编译错误
classTestApp{publicstaticvoidmain(String[]args){intx=5;switch(x){case1:case2:case3:System.out.println(一季度”);break;case4:case5:case6:System.out.println(二季度”);case7:case8:case9:System.out.println(三季度”);break;ase10:case11:ase12:System.out.println(四季度”);break;default:System.out.println(不是有效的月份”);}}}上述程序运行后的结果是哪项?()A.一季度B.二季度C.三季度D.四季度
程序:classTestApp{publicstaticvoidmain(String[]args){intX=5:switch(x){casel:case2:case3:System.out.println(一季度”);break;case4:case5:case6:System.out.println(二季度”);break;default:System.out.println(三季度以上”);break;}}}上述程序运行后的结果是哪项?()A.一季度B.二季度C.三季度以上D.无输出
下面程序的输出结果是( )。 public class Sun { public static void main(String args[ ]) { int i = 1; switch (i) { case 0: System.but.println("zero"); break; case 1: System.out.println("one"); case 2: System.out.println("two"); default: System.out.println ("default"); } } }A.oneB.one, defaultC.one, two, defaultD.default
给出下面代码片段: public class Test{ public static void main (String args[ ]){ int m; switch(m) { case 0:System.out.println("case 0"); case 1:System.out.println("case 1"):break; case 2: default:System.out.println("default"); } } } 下列m的( )值将引起"default"的输出。A.1B.2C.4D.0
给出下列代码段: public class ex38 { public static void main (String args [ ] ) { int m; switch(m) { case 0: System.out.println ( "case 0" ); case 1:System.out.println("case 1");break; case 2: default: System.out.print in ("default") } } 下列m的______值将引起"default"的输出。A.0B.1C.2D.以上答案都不正确
下列语句序列执行后,k的值是______。 public class Testll { public static void main(String[] args) { int a=10, b=18, c=30; switch(b%a){ case 7: c--;break; case 8: c-=2;break; case 9: c-=3;break; default: c * =b;break; } System.out.println(c); } }A.28B.27C.29D.540
下列程序执行的结果是______。 public class ex6 { public static void main(String[] args) { char ch='8'; int r=10; switch(ch+l) { case '7': r=r+3; case '8': r=r+5; case '9': r=r+6; break; default: ; } System.out.print(r); } }A.14B.13C.16D.10
下列语句序列执行后,k的值是 ( ) public class c9{ public static void main(String[]args){ int a=10,b=18,c=30; switch(b%A) { case 7:c--;break case 8:c-=2;break; case 9:c-=3;break; default : c * =b;break; } System.out.println(C) ; } }A.28B.29C.27D.540
下列程序的输出的结果是______。 public class exl6 { public static void main(String[] args) { int j=10; for(int i=0;i<3;i++) { j-=i+1; switch (j){ case 3: break; case 5: break; case 8: break; default: j=0;break; } } System,out.println(j); } }A.5B.3C.8D.0
下列程序执行之后,将输出 public class exl9 { public static void main(string[] args) { int x=3; int y=7; switch(y/x){ case 1: y*=2; break; case 2: y*=3; break; case 3: y*=4; break; default: y=0; } System.out.print(y); } }A.28B.21C.14D.0
给出下面代码段: public class Test{ public static void main(String args[] ) { int m; switch(m) { case 0: System.out.println("case 0"); case 1: System.out.println("case 1"); break; case 2: break; default: System.out.println("default"); } } } 下列m的值能引起输出“default”的是( )。A.0B.1C.2D.4
以下程序的运行结果为?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
1. public class SwitchTest { 2. public static void main (String []args) { 3. System.out.PrintIn(“value =” +switchIt(4)); 4. } 5. public static int switchIt(int x) { 6. int j = 1; 7. switch (x) { 8. case 1: j++; 9. case 2: j++; 10. case 3: j++; 11. case 4: j++; 12. case 5: j++; 13. default:j++; 14. } 15. return j + x; 16. } 17. } What is the output from line 3?() A、 Value = 3B、 Value = 4C、 Value = 5D、 Value = 6E、 Value = 7F、 Value = 8
public class SwitchTest { public static void main(String[] args) { System.out.println(“value = “ + switchIt(4)); } public static int switchIt(int x) { int j = 1; switch (x) { case 1: j++; case 2: j++; case 3: j++; case 4: j++; case 5: j++; default: j++; } return j + x; } } What is the result?() A、 value = 3B、 value = 4C、 value = 5D、 value = 6E、 value = 7F、 value = 8
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? () A、 0B、 2C、 4D、 6E、 9F、 13
程序: classTestApp{ public static void main (String[] args){ int X=5: switch (x){ case l: case 2: case 3: System. out.println(“一季度”); break; case 4: case 5: case 6: System. out.println(“二季度”); break;default:System. out.println(“三季度以上”); break; ) } ) 上述程序运行后的结果是哪项?()A、一季度B、二季度C、三季度以上D、无输出
程序: class TestApp{ public static void main (String[] args){ int X=5: switch (x){ case l: case 2: case 3: System. out.println(“一季度”); break; case 4: case 5: case 6: System. out.println(“二季度”); break; default: System. out.println(“三季度以上”); break; } } } 上述程序运行后的结果是哪项?() A、 一季度B、二季度C、三季度以上D、无输出
public class SwitchTest { public static void main (String args) { System.out.PrintIn(“value =” +switchIt(4)); } public static int switchIt(int x) { int j = 1; switch (x) { case 1: j++; case 2: j++; case 3: j++; case 4: j++; case 5: j++; default:j++; } return j + x; } } What is the output from line 3? ()A、 Value = 3B、 Value = 4C、 Value = 5D、 Value = 6E、 Value = 7F、 Value = 8
单选题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? ()A 0B 2C 4D 6E 9F 13
单选题public class SwitchTest { public static void main(String[] args) { System.out.println(“value = “ + switchIt(4)); } public static int switchIt(int x) { int j = 1; switch (x) { case 1: j++; case 2: j++; case 3: j++; case 4: j++; case 5: j++; default: j++; } return j + x; } } What is the result?()A value = 3B value = 4C value = 5D value = 6E value = 7F value = 8
单选题class TestApp{ public static void main(String[] args){ int x = 5; switch(x){ case 1: case 2: case 3: System.out.println(“一季度”); break; case 4: case 5: case 6: System.out.println(“二季度”); case 7: case 8: case 9: System.out.println(“三季度”); break; ase 10: case 11: ase 12: System.out.println(“四季度”); break; default: System.out.println(“不是有效的月份”); } } } 上述程序运行后的结果是哪项?()A一季度B二季度C三季度D四季度
单选题程序: class TestApp{ public static void main (String[] args){ int X=5: switch (x){ case l: case 2: case 3: System. out.println(“一季度”); break; case 4: case 5: case 6: System. out.println(“二季度”); break; default: System. out.println(“三季度以上”); break; } } } 上述程序运行后的结果是哪项?()A 一季度B二季度C三季度以上D无输出