May 25
Java 9-23 Essential Features: The Ultimate Developer's Cheat Sheet
Java has transformed since version 9. Catch up on all the must-know features that will skyrocket your productivity and modernize your code. This is the essential running guide for Java developers who want to stay ahead of the curve.
Java 9: A Farewell to Feature-Packed Releases (September 2017)
Top Features:
- Project Jigsaw (JPMS): Modularized the Java platform for improved security and maintainability.
- VarHandles: Provided safer access to memory compared to sun.misc.Unsafe.
- JShell: Introduced a REPL (Read-Eval-Print-Loop) environment for interactive coding.
- G1 as Default Garbage Collector: Made G1 the default garbage collector for improved performance.
- StackWalking API: Offered easier access to information within stack traces.
High-Level Summary:
Java 9 marked the end of feature-oriented releases, focusing instead on modularity and improved developer experience. It introduced JPMS for better application structure, safer memory access with VarHandles, and JShell for interactive development. Additionally, G1 became the default garbage collector for enhanced performance, and the StackWalking API simplified stack trace analysis.
Java 9 marked the end of feature-oriented releases, focusing instead on modularity and improved developer experience. It introduced JPMS for better application structure, safer memory access with VarHandles, and JShell for interactive development. Additionally, G1 became the default garbage collector for enhanced performance, and the StackWalking API simplified stack trace analysis.
JPA Link: https://openjdk.org/projects/jdk9/
Empty space, drag to resize
Java 10: Smaller Releases, More Frequent Updates (March 2018)
Top Features:
- Local-Variable Type Inference (var): Eliminated the need to explicitly declare variable types in specific cases.
- Garbage Collector Interface: Provided a standardized interface for managing different garbage collectors.
- G1 Improvements: Enhanced the G1 garbage collector with parallel full GC capabilities.
- Application Class-Data Sharing: Allowed sharing of application metadata across deployments for faster startup times.
- New Collectors for Unmodifiable Collections: Introduced convenient methods to create unmodifiable collections.
High-Level Summary:
Java 10 ushered in the new release cycle with a focus on smaller but more frequent updates. It introduced local-variable type inference (var) for more concise code, a Garbage Collector interface for better GC management, and improvements to the G1 collector. Application class-data sharing was introduced for faster application startup, and new collectors simplified working with unmodifiable collections.
Java 10 ushered in the new release cycle with a focus on smaller but more frequent updates. It introduced local-variable type inference (var) for more concise code, a Garbage Collector interface for better GC management, and improvements to the G1 collector. Application class-data sharing was introduced for faster application startup, and new collectors simplified working with unmodifiable collections.
JPA Link: https://openjdk.org/projects/jdk/10/
Empty space, drag to resize
Java 11 (LTS): Long-Term Support and Modernization (September 2018)
Top Features:
- HTTP Client: Provided a built-in client for making HTTP requests.
- Flight Recorder: Enabled collection of performance data for application profiling.
- Experimental Garbage Collectors (ZGC & Epsilon): Introduced low-pause garbage collectors for improved performance.
- Removal of Java EE & CORBA Modules: Removed modules no longer considered core Java features.
- Optional API Enhancement (isEmpty()) & String API Additions: Added isEmpty() method to Optional API and new methods for string manipulation in String API.
High-Level Summary:
Java 11 marked the introduction of Long-Term-Support (LTS) releases, providing extended support for critical applications. It introduced the HTTP Client for web communication, Flight Recorder for performance analysis, and experimental low-pause garbage collectors for better responsiveness. Java EE and CORBA modules were removed, and the Optional API gained an isEmpty() method. The String API received new methods for more versatile string handling.
Java 11 marked the introduction of Long-Term-Support (LTS) releases, providing extended support for critical applications. It introduced the HTTP Client for web communication, Flight Recorder for performance analysis, and experimental low-pause garbage collectors for better responsiveness. Java EE and CORBA modules were removed, and the Optional API gained an isEmpty() method. The String API received new methods for more versatile string handling.
JPA Link: https://openjdk.org/projects/jdk/11/
Empty space, drag to resize
Java 12: Focus on Refinements (March 2019)
Top Features:
- Switch Expressions (Preview): Introduced a more concise syntax for switch statements.
- G1 Improvements: Further enhancements were made to the G1 garbage collector.
- New Experimental Garbage Collector (Shenandoah): Introduced another experimental garbage collector with low-pause times.
High-Level Summary:
Java 12 was a minor release that primarily focused on refinements. It introduced Switch Expressions (preview) for more readable conditional statements, along with additional improvements to the G1 collector. Additionally, a new experimental garbage collector called Shenandoah was introduced.
Java 12 was a minor release that primarily focused on refinements. It introduced Switch Expressions (preview) for more readable conditional statements, along with additional improvements to the G1 collector. Additionally, a new experimental garbage collector called Shenandoah was introduced.
JPA Link: https://openjdk.org/projects/jdk/12/
Empty space, drag to resize
Java 13: Smallest Release with Significant Improvements (September 2019)
Top Features:
- Refined Switch Expressions: Switch Expressions received further enhancements based on developer feedback.
- Text Blocks (Preview): Introduced a multi-line string literal syntax for cleaner code.
- Socket API Reimplementation: Improved performance and efficiency of the Socket API.
- Linux/AArch64 Support for ZGC: Enabled ZGC, the low-pause garbage collector, on Linux AArch64 architecture.
High-Level Summary:
Java 13 holds the record for the smallest release. It concentrated on improvements to existing features. Switch Expressions were further refined, Text Blocks (preview) were introduced for easier multi-line string creation, the Socket API was reimplemented for better performance, and ZGC gained support for the Linux/AArch64 architecture.
Java 13 holds the record for the smallest release. It concentrated on improvements to existing features. Switch Expressions were further refined, Text Blocks (preview) were introduced for easier multi-line string creation, the Socket API was reimplemented for better performance, and ZGC gained support for the Linux/AArch64 architecture.
JPA Link: https://openjdk.org/projects/jdk/13/
Empty space, drag to resize
Java 14: A Wave of Interesting Additions (March 2020)
Top Features:
- Pattern Matching for instanceof (Preview): Introduced a new syntax for type checks with pattern matching.
- JFR Event Streaming: Enabled real-time monitoring of performance data from Flight Recorder.
- Records (Preview): Introduced a concise syntax for defining immutable data classes.
- Improved NullPointerException Messages: Enhanced error messages for NullPointerExceptions to provide more context about the cause.
- Switch Expressions to Standard: Switch Expressions graduated from preview to a standard feature.
High-Level Summary:
Java 14 brought a wave of exciting new features. Pattern Matching for instanceof (preview) offered a more concise way to perform type checks. JFR Event Streaming allowed for real-time analysis of performance data. Records (preview) provided a simpler way to define immutable data objects. NullPointerException messages were enhanced to provide more informative error messages. Finally, Switch Expressions became a standard feature.
Java 14 brought a wave of exciting new features. Pattern Matching for instanceof (preview) offered a more concise way to perform type checks. JFR Event Streaming allowed for real-time analysis of performance data. Records (preview) provided a simpler way to define immutable data objects. NullPointerException messages were enhanced to provide more informative error messages. Finally, Switch Expressions became a standard feature.
JPA Link: https://openjdk.org/projects/jdk/14/
Empty space, drag to resize
Java 15: Standard Features and New Previews (September 2020)
Top Features:
- Removed Nashorn JavaScript Engine & Biased Locking: Removed the Nashorn engine for JavaScript execution and disabled biased locking for improved performance.
- Standard Features (Text Blocks, ZGC, Shenandoah): Promoted Text Blocks, ZGC, and Shenandoah from preview to standard features.
- Sealed Classes (Preview): Introduced Sealed Classes for restricting class inheritance hierarchies.
- Hidden Classes: Provided a way to hide internal implementation classes.
- DatagramSocket API Reimplementation: Improved the performance and efficiency of the DatagramSocket API.
High-Level Summary:
Java 15 focused on both standardization and introducing new features as previews. Several features, including Text Blocks, ZGC, and Shenandoah, graduated to standard status. Sealed Classes (preview) offered more control over inheritance, and Hidden Classes allowed for better encapsulation. The DatagramSocket API received a reimplementation for enhanced performance.
Java 15 focused on both standardization and introducing new features as previews. Several features, including Text Blocks, ZGC, and Shenandoah, graduated to standard status. Sealed Classes (preview) offered more control over inheritance, and Hidden Classes allowed for better encapsulation. The DatagramSocket API received a reimplementation for enhanced performance.
JPA Link: https://openjdk.org/projects/jdk/15/
Empty space, drag to resize
Java 16: Significant Update with Records and More (March 2021)
Top Features:
- Records to Standard: Records became a standard feature for defining immutable data classes.
- jpackage to Standard: jpackage, a tool for creating self-contained applications, became a standard feature.
- Unix Domain Socket Channels: Introduced support for Unix Domain Socket communication.
- Elastic Metaspace: Minimized wasted memory space in the metaspace.
- ZGC Improvements (Concurrent Thread-Stack Processing): Further enhanced the ZGC garbage collector with concurrent thread-stack processing.
High-Level Summary:
Java 16 marked a significant update with Records and jpackage becoming standard features. It introduced support for Unix Domain Socket communication for inter-process communication. Elastic metaspace improved memory management, and the ZGC collector received further enhancements. OpenJDK development transitioned to Git for better collaboration, and newer C++ constructs were incorporated in the JVM code.
Java 16 marked a significant update with Records and jpackage becoming standard features. It introduced support for Unix Domain Socket communication for inter-process communication. Elastic metaspace improved memory management, and the ZGC collector received further enhancements. OpenJDK development transitioned to Git for better collaboration, and newer C++ constructs were incorporated in the JVM code.
JPA Link: https://openjdk.org/projects/jdk/16/
Empty space, drag to resize
Java 17 (LTS): Long-Term Support and Continued Evolution (September 2021)
Top Features:
- Sealed Classes to Production-Ready: Sealed Classes became fully usable for production environments.
- Switch-Case Pattern Matching (Preview): Introduced pattern matching capabilities within switch statements (preview).
- Enhanced Pseudo-Random Number Generators: Improved the quality and performance of random number generation.
- Deprecation of the Applet API: Marked the Applet API for future removal.
- Removal of Experimental AOT/Graal Support: Removed experimental support for Ahead-Of-Time compilation and the GraalVM.
High-Level Summary:
Java 17 marked another LTS release with extended support. Sealed Classes became production-ready, and switch-case pattern matching entered the preview stage. The release focused on core improvements, including better random number generation. The Applet API and experimental support for AOT/Graal were deprecated for eventual removal.
Java 17 marked another LTS release with extended support. Sealed Classes became production-ready, and switch-case pattern matching entered the preview stage. The release focused on core improvements, including better random number generation. The Applet API and experimental support for AOT/Graal were deprecated for eventual removal.
JPA Link: https://openjdk.org/projects/jdk/17/
Empty space, drag to resize
Java 18: Focus on Core Improvements (March 2022)
Top Features:
- UTF-8 as Default Charset: Made UTF-8 the default character encoding for consistent behavior across platforms.
- Revised Vector API: Introduced revisions to the Vector API for improved performance.
- Reflection API Reimplementation with MethodHandles: Reimplemented parts of the Reflection API using MethodHandles for better efficiency.
- Deprecation of Finalization for Removal: Deprecated the Finalization mechanism for eventual removal from the language.
- SPI for java.net.InetAddress's Resolvers: Introduced a Service Provider Interface (SPI) for customizing DNS resolvers.
- Simple Web Server (Surprise!): Introduced a simple, built-in web server for basic static file serving.
High-Level Summary:
Java 18 concentrated on core improvements and internal enhancements. UTF-8 became the default character encoding for universal text handling. The Vector API received revisions, and the Reflection API saw a partial reimplementation using MethodHandles. Finalization was deprecated for future removal, and a SPI was introduced for more control over DNS resolution. Surprisingly, a simple web server was introduced for basic web serving functionalities.
Java 18 concentrated on core improvements and internal enhancements. UTF-8 became the default character encoding for universal text handling. The Vector API received revisions, and the Reflection API saw a partial reimplementation using MethodHandles. Finalization was deprecated for future removal, and a SPI was introduced for more control over DNS resolution. Surprisingly, a simple web server was introduced for basic web serving functionalities.
JPA Link: https://openjdk.org/projects/jdk/18/
Empty space, drag to resize
Java 19: Packed with Preview Features (September 2022)
Top Features:
- Foreign Function & Memory API: Introduced an API for interoperating with native code and memory.
- Project Loom: Offered a preview of lightweight threads (virtual threads) for improved concurrency.
- Vector API: The Vector API continued its development in the preview stage.
- Pattern Matching for switch: Switch statements gained pattern matching capabilities (preview).
- Structured Concurrency: Introduced a preview of Structured Concurrency for simplified asynchronous programming.
High-Level Summary:
Java 19 was brimming with exciting new features, but all were introduced as previews. These features promised significant advancements in various areas. The Foreign Function & Memory API allowed for interaction with native code. Project Loom offered a glimpse into lightweight threads for better concurrency. The Vector API continued its development for efficient vector operations. Pattern matching within switch statements and Structured Concurrency for asynchronous programming were also introduced as previews.
Empty space, drag to resize
Java 20: Primarily Experimental and Preview Features (March 2023)
Top Features:
- Scoped Values (incubator): Introduced Scoped Values (incubator) for managing resource lifetimes within a specific scope.
- Record Patterns (Second Preview): Record Patterns received further refinements for more concise pattern matching with records.
- Pattern Matching for switch (Fourth Preview): Switch-case pattern matching continued its development cycle.
- Foreign Function & Memory API (Second Preview): The Foreign Function & Memory API progressed through the preview stages.
- Virtual Threads (Second Preview): Virtual threads were further refined in the second preview.
- Structured Concurrency (Second incubator): Structured Concurrency remained in the incubator stage with ongoing development.
- Vector API (Sixth Incubator): The Vector API continued its incubation phase.
High-Level Summary:
Java 20 primarily focused on experimental and preview features. Scoped Values (incubator) offered a mechanism for managing resources within a specific scope. Record Patterns and switch-case pattern matching were further developed. The Foreign Function & Memory API, Virtual Threads, Structured Concurrency, and the Vector API continued their respective preview or incubator stages, indicating ongoing refinement before potential stabilization.
Java 20 primarily focused on experimental and preview features. Scoped Values (incubator) offered a mechanism for managing resources within a specific scope. Record Patterns and switch-case pattern matching were further developed. The Foreign Function & Memory API, Virtual Threads, Structured Concurrency, and the Vector API continued their respective preview or incubator stages, indicating ongoing refinement before potential stabilization.
Empty space, drag to resize
Java 21: Previews Take Center Stage with Some GA Releases (September 2023)
Top Features:
- Virtual Threads (GA): Virtual threads became generally available for improved concurrency management.
- Record Patterns and Switch-Case Pattern Matching (GA): Record patterns and switch-case pattern matching graduated to general availability, offering more concise and readable code.
- Key Encapsulation Mechanism API: Introduced an API for managing access to critical application data.
- Sequenced Collections: Provided thread-safe collections that maintain insertion order.
- Generational ZGC: Introduced a new generational garbage collector for improved memory management (GA in some configurations).
High-Level Summary:
Java 21 delivered some significant features to general availability. Virtual threads became fully usable, simplifying concurrent programming. Record patterns and switch-case pattern matching matured and offered new capabilities for concise pattern matching. The Key Encapsulation Mechanism API provided better control over access to sensitive data. Sequenced Collections ensured thread-safe operations while maintaining order. Generational ZGC, in specific configurations, offered a new approach to memory management. Several other features remained in preview stages for further development.
Java 21 delivered some significant features to general availability. Virtual threads became fully usable, simplifying concurrent programming. Record patterns and switch-case pattern matching matured and offered new capabilities for concise pattern matching. The Key Encapsulation Mechanism API provided better control over access to sensitive data. Sequenced Collections ensured thread-safe operations while maintaining order. Generational ZGC, in specific configurations, offered a new approach to memory management. Several other features remained in preview stages for further development.
Empty space, drag to resize
Java 22: Foreign Function & Memory API Takes the Stage (March 2024)
Top Features:
- Foreign Function & Memory API (GA): The Foreign Function & Memory API became generally available, allowing efficient interaction with native code and memory.
- Unnamed Variables & Patterns (GA): Unnamed variables and patterns were introduced for cleaner and more concise code.
Major Previews:
- Scoped Values (Second Preview): Scoped Values continued development for improved resource management within specific scopes.
- Structured Concurrency (Second Preview): Structured Concurrency remained in the preview stage for further refinement of asynchronous programming constructs.
- String Templates (Second Preview): String Templates offered a new way for string interpolation with previews for further enhancements.
High-Level Summary:
Java 22 marked the arrival of the long-awaited Foreign Function & Memory API, enabling efficient communication with native code and memory. Unnamed variables and patterns improved code readability and maintainability. The release also included further refinements to features like Scoped Values for thread-safe resource management, Structured Concurrency for simplified asynchronous programming, and String Templates for easier string manipulation. These features remained in preview stages for ongoing development and potential future stabilization.
Empty space, drag to resize
Java 23: Elevates Performance and Productivity (September 2024)
Top Features:
- Primitive Types in Patterns, instanceof, and switch (Preview): Expands pattern matching to support primitive types, reducing boilerplate code.
- Scoped Values (Third Preview): Introduces variables with limited lifetimes to improve memory management.
- Structured Concurrency (Third Preview): Enhances thread management with structured APIs, simplifying concurrency handling.
- Markdown Documentation Comments: Adds Markdown support for Javadoc, improving the readability of documentation.
- ZGC as Default Garbage Collector: The generational Z Garbage Collector (ZGC) becomes the default, boosting performance and responsiveness.
High-Level Summary:
Java 23 continues the trend of improving performance and developer productivity. It refines pattern matching with support for primitive types, introduces scoped values for safer memory management, and simplifies concurrency with structured APIs. Markdown documentation improves the developer experience, and ZGC as the default collector ensures better performance and low latency.
Java 23 continues the trend of improving performance and developer productivity. It refines pattern matching with support for primitive types, introduces scoped values for safer memory management, and simplifies concurrency with structured APIs. Markdown documentation improves the developer experience, and ZGC as the default collector ensures better performance and low latency.
JPA Link: https://openjdk.org/projects/jdk/23/
Some of the Code Examples from Java 23 features:
1. Primitive Types in Pattern Matching (JEP 455): Pattern matching with primitive types simplifies instanceof and switch statements, improving readability.
2. Scoped Values for Safer Memory Management (JEP 441): Scoped values allow variables to be confined to specific contexts, reducing accidental data leaks.
3. Structured Concurrency (JEP 428): Structured concurrency simplifies multi-threaded code by ensuring all threads complete before the main thread proceeds.
4. Markdown Documentation Comments (JEP 467): Improved Javadoc with Markdown support enhances the structure and readability of documentation.
Empty space, drag to resize
Who we are
We're a team of tech lovers who want to help others succeed in their careers. Our goal is to make learning easier and help people get better at what they do. We create easy-to-understand revision guides and interview prep resources that break down tricky tech stuff, making it simpler for everyone to learn and grow.
Courses
-
Study Kit
-
Blogs
-
Join Our Team
-
Newsletter
Other Links
Copyright © 2024