black

SCJP程序员认证考试

登录

单项选择题

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 = 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?()

多项选择题 Whichtwocreateaninstanceofanarray?()

单项选择题 public class Test {   public static void main (String args) {   class Foo {   public int i = 3;  }   Object o = (Object) new Foo();   Foo foo = (Foo)o;   System.out.printIn(foo. i);  }   }   What is the result?()

All Rights Reserved 版权所有©财会考试题库(ckkao.com)

备案号:湘ICP备2022003000号-2