Loading topic
final, records, and basic switch expressions. This chapter uses Java 17 sealed types. The pattern-matching ideas shown here also require Java 21 where noted.2 min readfinal keyword. This chapter focuses on the location rules for permitted subclasses. These rules determine whether a sealed hierarchy can span several files or packages.2 min readswitch became permanent in Java 21.2 min readswitch cases.2 min readswitch, which requires Java 21 or later.2 min readfinal keyword. It also assumes you can read switch expressions. The focus here is on the restrictions that make a sealed hierarchy closed and predictable.2 min readfinal keyword. It also assumes basic familiarity with Java reflection, which is the ability to inspect classes while a program is running.2 min read