Challenge 1: Adding a Fourth OrderStatus Variant — Possible Solution ==================================================================== Updated OrderStatus.java: public sealed interface OrderStatus permits Pending, Shipped, Cancelled, Returned {} public record Pending() implements OrderStatus {} public record Shipped(String trackingNumber) implements OrderStatus {} public record Cancelled(String reason) implements OrderStatus {} public record Returned(String reason) implements OrderStatus {} // new Updated switch (with the new case added): String summary = switch (status) { case Pending p -> "Awaiting shipment"; case Shipped s -> "Shipped: " + s.trackingNumber(); case Cancelled c -> "Cancelled: " + c.reason(); case Returned r -> "Returned: " + r.reason(); // new case }; If the Returned case is forgotten (left out of the switch): OrderStatus.java:15: error: the switch expression does not cover all possible input values String summary = switch (status) { ^ 1 error Explanation: Adding Returned to the permits clause immediately expands the sealed type's known, closed set from three to four possible subtypes. Any existing switch over OrderStatus that hasn't been updated to include a Returned case is now provably incomplete, and the compiler catches this immediately rather than letting a Returned value silently fall through with no matching branch at runtime. WHY THIS WORKS AS AN ANSWER ------------------------------ This demonstrates the real, practical value of exhaustive switch over a sealed type: extending the permitted set surfaces every switch that now needs updating as a compile error, rather than a bug discovered later at runtime.