Multiple choice technology programming languages

package testswitch; public class TestSwitch4 { public static void main(String[] args) { int x = 2; switch (x) { default: System.out.println("Default"); case 3: System.out.println("I am in 3"); case 1: System.out.println("I am in 1"); } } }

  1. Default I am in 3 I am in 1

  2. Default

  3. No output

  4. Exception

Reveal answer Fill a bubble to check yourself
A Correct answer
Explanation

The switch expression x has value 2, which does not match either case 3 or case 1. Java executes the default case when there is no match. Since there is no break statement after the default case, execution falls through to case 3 and then to case 1, printing all three outputs.