Friday, 7 September 2012

What is the output of following piece of code ? | Java JDBC

int x = 2;
switch (x) {
case 1:System.out.println(“1?);
case 2:
case 3:System.out.println(“3?);
case 4:
case 5:System.out.println(“5?);
}
A. No output
B. 3 and 5
C. 1, 3 and 5
D. 3

Ans:  B

No comments: