Multiple choice technology programming languages

public class SwitchTest { public static void main(String[] args) { Boolean b = Boolean.TRUE; switch(b) { case(true): System.out.println("A"); case(false): System.out.println("B"); case(3): System.out.println("C"); } } } output?

  1. A

  2. ABC

  3. comilation fails

  4. AB

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

Compilation fails for two reasons: (1) Switch statements on Boolean wrapper types are not supported in Java - only int-compatible types, enums, and String (Java 7+) are allowed. (2) The case syntax case(true) with parentheses is incorrect even for valid switch types; cases must use constant values without parentheses.