易搜题 > 资格证大类 > 计算机编程 > 问题详情
问题详情

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

未找到的试题在搜索页框底部可快速提交,在会员中心"提交的题"查看可解决状态。 收藏该题
查看答案

相关问题推荐

  • It is desirable that a certain method within a certain class can only be accessed by classes that are defined within the same package as the class of the method. How can such restrictions be enforced?()  

    A、Mark the method with the keyword public.

    B、Mark the method with the keyword protected.

    C、Mark the method with the keyword private.

    D、Mark the method with the keyword package.

    E、Do not mark the method with any accessibility modifiers.

  • 11. String test = “This is a test”;  12. String[] tokens = test.split(”/s”);  13. System.out.println(tokens.length);  What is the result?() 

    A、 0

    B、 1

    C、 4

    D、 Compilation fails.

    E、 An exception is thrown at runtime.

  • int i = 0, j = 5;  tp;   for (;;) {  i++;  for(;;) {  if (i> --j) {  break tp;  break tp;  }  }  System.out.println(“i=” +i “,j =”+j); } What is the result?()  

    A

     i = 1, j = 0

    B

     i = 1, j = 4

    C

     i = 3, j = 4

    D

     i = 3, j = 0

    E

     Compilation fails.

  • for (int i =0; i 

    A、 0 2 4

    B、 0 2 4 5

    C、 0 1 2 3 4

    D、 Compilation fails.

    E、 An exception is thrown at runtime.

  • Assuming that the serializeBanana( ) and the deserializeBanana( ) methods will correctly use Java serialization and given:   What is the result?()

    A、 restore 400

    B、 restore 403

    C、 restore 453

    D、 Compilation fails.

    E、 An exception is thrown at runtime.

联系客服 会员中心
TOP