CJCoding With Joseph
15per day
← Back to Question List

Select topics to narrow your question pool, then enable Random to jump to a random question matching your filters.

Topics:
Java Quiz #21

Switch Fall Through

mediumConditionals

What is printed when x is 2?

📄 Code

1public class Main {
2 public static void main(String[] args) {
3 int x = 2;
4 
5 switch (x) {
6 case 1:
7 System.out.print("A");
8 case 2:
9 System.out.print("B");
10 case 3:
11 System.out.print("C");
12 break;
13 default:
14 System.out.print("D");
15 }
16 }
17}