多做题,通过考试没问题!

Java认证考试

睦霖题库>其他计算机考试>Java认证考试

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
正确答案:F
答案解析:
进入题库查看解析

微信扫一扫手机做题