

MCQOPTIONS
Saved Bookmarks
1. |
What will be the output of the program?
public class SwitchTest { public static void main(String[] args) { System.out.println("value =" + switchIt(4)); } public static int switchIt(int x) { int j = 1; switch (x) { case l: j++; case 2: j++; case 3: j++; case 4: j++; case 5: j++; default: j++; } return j + x; } } |
A. | Value = 2 |
B. | Value = 4 |
C. | Value = 6 |
D. | Value = 8 |
Answer» E. | |