The Java JDK 11 was officially released on September 25, 2018. It is a long-term support (LTS) release, meaning it receives updates and bug fixes for an extended period until September 2026.
Below is the list of JEPs that were part of Java 11 development.
Let's try and take a look at some of the new features that were introduced in Java JDK 11 in brief.
Nest-Based Access Control (JEP 181)
Enhanced the access control for nested classes.
JEP 181 introduced nests, enabling logically related classes compiled into separate files to access each other's private members without requiring additional accessibility bridge methods to be inserted by the compiler.
Example:
1. class OuterClass {
2. private int x;
3. class InnerClass {
4. void doSomething() {
5. x = 10; //Accessing the private field of the outer class
6. }
7. }
8. }
Dynamic Class-File Constants (JEP 309)
A new constant-pool CONSTANT_Dynamic form was added to the Java class-file format to efficiently load constants in class files.
Example:
public class Constants {
public static final int SUNDAY = 0;
public static final int MONDAY = 1;
}
Improve Aarch64 Intrinsics (JEP 315)
JEP 315 enhanced the performance of Java applications on AArch64 processors by optimizing intrinsics.
Intrinsics allowed the execution of CPU-specific assembly code instead of generic Java code to boost performance.
Improvements were made by implementing intrinsics for java.lang.Math functions like sin, cos, and log, as well as improving existing intrinsics for string and array operations.
Example:
public static void main(String[] args) {
double angle = 45.0;
double result = Math.sin(angle); // Benefitted from optimized intrinsics on AArch64
}
If you have a Java application that uses the Math.sin function frequently. With JEP 315, the implementation of Math.sin was optimized for AArch64 processors - such as Apple Silicon Chip based M1/M2 processors.
Epsilon: A No-Op Garbage Collector (Experimental) (JEP 318)
JEP 318 introduced Epsilon, a unique experimental (No-Op) garbage collector for Java. Unlike traditional garbage collectors, Epsilon doesn't perform memory reclamation; it simply handles memory allocation. When the Java heap is full, the JVM shuts down.
Helpful for:
Performance Testing
Memory Pressure Testing
VM Interface Testing
Short-Lived Jobs
Latency Improvements
Throughput Improvements
We can enable Epsilon by passing the below argument to the Java Virtual Machine (JVM).
-XX:+UseEpsilonGC
Remove the Java EE and CORBA Modules (JEP 320)
As part of JEP 320, the Java EE and CORBA modules are being removed from the Java SE Platform and JDK because they were deprecated in Java SE 9. This simplifies Java SE, reduces maintenance complexity, and encourages developers to use standalone versions of these technologies.
The inclusion of Java EE and CORBA technologies caused maintenance challenges due to differences between Java SE and Java EE versions. Standalone alternatives are readily available, making their inclusion unnecessary.
In Java SE 9, these modules were marked for removal, and in Java SE 11, they will be removed, including source code deletion. Tools related to these modules will no longer be available. Tests related to Java EE and CORBA APIs will be removed.
HTTP Client (JEP 321)
The HTTP Client API which was introduced in Java 9, was added as a standard feature in Java JDK 11 by JEP-321.
Example:
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class HttpClientExampleJava11 {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(new URI("https://code2care.org/v2/api/get-users"))
.GET()
.build();
HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
Local-Variable Syntax for Lambda Parameters (JEP 323)
By this JEP, var can be used when declaring the formal parameters of implicitly typed lambda expressions.
Example:
import java.util.function.Predicate;
public class LambdaExampleJEP323 {
public static void main(String[] args) {
Predicate isNotEmpty = (var s) -> s != null && !s.isEmpty();
System.out.println(isNotEmpty.test("Code2care!"));
}
}
Unicode 10 (JEP 327)
- Character and String in the java.lang package.
- NumericShaper in the java.awt.font package.
- Bidi, BreakIterator, and Normalizer in the java.text package.
Below existing classes were enhanced to support version 10.0 of the Unicode Standard.
Example:
public static void main(String[] args) {
char heartSymbol = '\u2764';
System.out.println("Heart Symbol: " + heartSymbol);
}
Facing issues? Have Questions? Post them here! I am happy to answer!
Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.
Follow him on: X
You can also reach out to him via e-mail: rakesh@code2care.org
- Get the current timestamp in Java
- Java Stream with Multiple Filters Example
- Java SE JDBC with Prepared Statement Parameterized Select Example
- Fix: UnsupportedClassVersionError: Unsupported major.minor version 63.0
- [Fix] Java Exception with Lambda - Cannot invoke because object is null
- 7 deadly java.lang.OutOfMemoryError in Java Programming
- How to Calculate the SHA Hash Value of a File in Java
- Java JDBC Connection with Database using SSL (https) URL
- How to Add/Subtract Days to the Current Date in Java
- Create Nested Directories using Java Code
- Spring Boot: JDBCTemplate BatchUpdate Update Query Example
- What is CA FE BA BE 00 00 00 3D in Java Class Bytecode
- Save Java Object as JSON file using Jackson Library
- Adding Custom ASCII Text Banner in Spring Boot Application
- [Fix] Java: Type argument cannot be of primitive type generics
- List of New Features in Java 11 (JEPs)
- Java: How to Add two Maps with example
- Java JDBC Transition Management using PreparedStatement Examples
- Understanding and Handling NullPointerException in Java: Tips and Tricks for Effective Debugging
- Steps of working with Stored Procedures using JDBCTemplate Spring Boot
- Java 8 java.util.Function and BiFunction Examples
- The Motivation Behind Generics in Java Programming
- Get Current Local Date and Time using Java 8 DateTime API
- Java: Convert Char to ASCII
- Deep Dive: Why avoid java.util.Date and Calendar Classes
- Clearing the Cache in Firefox Web Browser - HowTos
- ModuleNotFoundError: No module named qdarkstyle.colorsystem [Python] - Python
- 3 Ways and Steps to Start Windows 11 PC in Safe Mode - Windows-11
- ASCII to HEX and HEX to ASCII Conversion Notepad++ - NotepadPlusPlus
- Command to unzip or extract tar.gz file on Linux or macOS? - Linux
- DDMS files not found hprof-conv.exe - Android
- How to Stop Mac from Sleeping (macOS Ventura and Above) - MacOS
- How to take Screenshots on macOS Sonoma 14 using Keyboard - MacOS