Skip to content
Veltoryx Technologies
ProLesson 13.4Intermediate2 min readUpdated 30 October 2026

Java 12 to 17: records, sealed classes and pattern matching

Switch expressions, text blocks, records, pattern matching for instanceof, sealed classes and helpful NullPointerExceptions, all final by Java 17 LTS.

Between Java 12 and 17, Java gained features that make everyday code shorter and safer. By Java 17 (LTS, 2021) all of these are final, and Java 17 is still one of the most common versions in production.

01The features and when they became final

FeatureFinal inLesson
Switch expressions (->, yield)Java 142.4
Helpful NullPointerException messagesJava 14 (on by default in 15)5.5
Text blocks (""")Java 153.5
RecordsJava 164.9
Pattern matching for instanceofJava 164.6
Stream.toList()Java 168.5
Sealed classesJava 174.9

Loading the rest of the lesson…