Challenge 2: Fallthrough vs. a Switch Expression — Possible Solution ==================================================================== SwitchDemo.java: public class SwitchDemo { public static void main(String[] args) { int month = 2; // Traditional switch -- deliberately missing a break switch (month) { case 1: case 2: System.out.println("Traditional (fallthrough): Early year"); // no break here on purpose case 3: System.out.println("Traditional (fallthrough): ...and also March!"); break; default: System.out.println("Traditional: Some other month"); } // Switch expression -- no fallthrough possible String season = switch (month) { case 1, 2 -> "Early year"; case 3 -> "March"; default -> "Some other month"; }; System.out.println("Expression (no fallthrough): " + season); } } Output: Traditional (fallthrough): Early year Traditional (fallthrough): ...and also March! Expression (no fallthrough): Early year Explanation: In the traditional switch, month == 2 matches case 2, prints its line, and -- because that case has no break -- execution falls straight into case 3's body and prints its line too, even though month is not 3. The switch expression rewrite has no fallthrough mechanism at all: only the matching branch (case 1, 2) runs, producing exactly one result, "Early year", assigned directly to season. WHY THIS WORKS AS AN ANSWER ------------------------------ The traditional version reproduces the exact fallthrough bug the chapter warns about -- a missing break causing an unrelated case's body to execute -- and the expression rewrite demonstrates the chapter's own claim that switch expressions never fall through, producing only the single correct branch's value.