📚 Practice Mode

Java Programming Language Quiz - 4

Learn at your own pace with hints and detailed explanations

1 / 9
Multiple Answers

What is the output of following piece of code ?

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?);
 }
  1. No output
  2. 3 and 5
  3. 1, 3 and 5
  4. 3