black

SCJP程序员认证考试

登录

单项选择题

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 = 3
B. Value = 4
C. Value = 5
D. Value = 6
E. Value = 7
F. Value = 8

相关考题

单项选择题 public class ExceptionTest {  class TestException extends Exception {}  public void runTest () throws TestException {}  public void test () /* Point X*/  {  runTest ();  }  }   At point X on line 4, which code can be added to make the code compile?()

单项选择题 1.public class Test {  2.public static void main (String args[]) {  3.class Foo {  4.public int i = 3;  5.}  6.Object o = (Object) new Foo();  7.Foo foo = (Foo)o;  8.System.out.printIn(foo. i); 9. }  10.}   What is the result?()

多项选择题 Whichtwodeclarationspreventtheoverridingofamethod?()

All Rights Reserved 版权所有©建筑考试题库(jzkao.com)

备案号:湘ICP备2020024380号-3