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?()
Ai = 1, j = 0
Bi = 1, j = 4
Ci = 3, j = 4
Di = 3, j = 0
ECompilation 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.