Sealed Classes in Java 17: Controlled Inheritance and Exhaustive Pattern Matching
Java 17 sealed classes let you lock down inheritance hierarchies and get compile‑time exhaustive pattern matching. This post shows how to declare a sealed interface, use it in a switch expression, and what to watch out for with proxies and modules.