Java 9, 10, and 11 brought many new features and improvements to the Java platform. Here is a list of the main features introduced in each version:
Java 9 Features
Module System (Project Jigsaw)
- He introduces the JDK and the Java Platform Module System (JPMS) for modularizing applications.
- It allows developers to create modular applications for better scalability, maintainability and performance.
JShell (Java Shell)
- An interactive REPL (Read-Eval-Print Loop) tool for generating Java code snippets and testing the Java API.
Improved Process API
- Enhanced API for monitoring and managing business process settings.
- It introduces the
ProcessHandle
class for accessing and managing native processes.
HTTP/2 client
- Native support for HTTP/2 in the java.net.http package.
- It provides a modern HTTP client API with support for WebSocket and asynchronous programming.
Private Methods in Interfaces
- Now interfaces can have private methods, which allow code to be reused without exposing them as part of the interface's public API.
Enhanced Stream API
- Adds several new methods such as takeWhile, dropWhile, and ofNullable to the Stream API.
Multi-Release JAR Files
- The ability to create a JAR file with separate class files for different versions of Java, allowing libraries to be created with different versions of Java.
Java 10 Features
Local Variable Type Inference (var keyword)
- It allows estimation of the characteristics of local variables, reducing the speculation.
Example-var list = new ArrayList<String>();
Parallel Full GC for G1
- Enhances Garbage-First (G1) garbage collection with parallel accuracy of garbage collection.
Application Class-Data Sharing
- It improves startup time and reduces memory footprint by sharing common class metadata across JVM instances.
Experimental Features
- It results in the
-XX:+UseDynamicNumberOfCompilerThreads
option for testing dynamic compiler thread allocation.
Java 11 Features
HTTP Client (Standard)
- Introduced in Java 9 (java.net.http), the HTTP client is standard as part of the JDK.
Local-Variable Syntax for Lambda Parameters
- Allow
var
to be used in lambda expressions to declare local variables.
Epsilon Garbage Collector
- It introduces a no-op garbage collector (
-XX:+UseEpsilonGC
) that is useful for performance testing and situations where garbage collection is not required.
Launch Single-File Source-Code Programs
- It allows you to execute the java source file directly with the java command without compiling it explicitly.
ZGC (Experimental)
- It introduces the Z Garbage Collector (-XX:+UseZGC) as an experimental feature, aimed at low latency applications.
TLS 1.3 Support
- It adds support for TLS 1.3, the latest version of the Transport Layer Security Protocol, which provides improved security and performance.
Deprecates java.xml.ws
and java.xml.bind
modules
- Obsolete modules from Java EE, mean a move to the much more modular and lightweight Java SE platform.
This version of Java brings significant improvements in modularity, performance, developer productivity, and security, demonstrating Oracle's commitment to the development of the Java platform.
Leave Comment