Java 8 to Java 21: Feature Comparison Cheat Sheet
Java 8 to Java 21 Summary
This document highlights the major changes and feature enhancements introduced in each Java version from Java 9 to
Java 21, following the baseline Java 8.
Major categories include: language syntax, standard API additions, JVM and GC improvements, and new programming
paradigms such as virtual threads, pattern matching, and records.
Java 9 (Sep 2017)
- JPMS (Module System) - 'module-info.java'
- JShell (REPL)
- Improved Stream API (takeWhile, dropWhile)
- Private methods in interfaces
- Multi-release JARs
Java 10 (Mar 2018)
- Local variable type inference (var)
- Application Class-Data Sharing (AppCDS)
- Thread-local handshakes
Java 11 (Sep 2018) - LTS
- New String methods (isBlank, strip, repeat, lines)
- HTTP Client API (standard)
- Running single-file Java source code
- Removed Java EE and CORBA modules
Java 12-13
- Switch expressions (preview)
Java 8 to Java 21: Feature Comparison Cheat Sheet
- Text blocks (preview)
Java 14-15
- Records (preview)
- Pattern matching for instanceof (preview)
- Helpful NullPointerExceptions
- Sealed classes (preview)
Java 16-17 - LTS
- Records and pattern matching standardized
- Sealed classes standardized
- Strong encapsulation of internal APIs
- Foreign linker and memory API (incubator)
Java 18-20
- Simple web server (jwebserver)
- Virtual threads (preview, Project Loom)
- Structured concurrency (incubator)
- Record patterns (preview)
Java 21 (Sep 2023) - LTS
- Virtual threads (standard)
- Record patterns (standard)
- Pattern matching for switch (standard)
- Sequenced collections
- String templates (preview)
- Foreign function and memory API (standard)
- Scoped values (preview)