CJCoding With Joseph
15free / daySign inCreate account
Back to Multiple Choice Quiz

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

Topics

Switch Fall Through

Java quiz · Question 21
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}