Member-only story
JAVA-RELEASE/JAVA-11
Java 11 [LTS]: Features and Highlights
This article covers features of Java 11 with code examples

Java 11, this was significant milestone in the evolution of Java 😲 and became a benchmark for Java developers. IT companies have begun to prefer hiring Java 11 developers 🌟. Released in September 2018, Java 11 came with improvements focused on productivity, security, and performance to enhance the overall Java experience for software engineers. In this article, we’ll dive into Java 11’s features, and illustrate scenarios using code examples.
8 out of 18 Notable Features and Improvements in Java 11
- Running Java files directly: Enhancements to
java
launcher allowing direct execution of single-file Java source code without explicit compilation. - Improved
var
handling: Improved type inference for lambda expressions usingvar
. - HTTP Client API: The introduction of a standard HTTP Client API supporting HTTP/1.1, HTTP/2, and WebSocket communication.
- String Functions: New utility methods added to the
String
class, such asrepeat()
,isBlank()
,strip()
,lines()
. - New Epsilon Garbage Collector: A no-op garbage collector to test the performance of applications.
- Java Flight Recorder (JFR) Event Streaming: The JFR now supports event streaming, providing more capabilities for monitoring and profiling Java applications.
- Eliminating Nashorn JavaScript Engine: The removal of the Nashorn JavaScript engine and associated API, making it unavailable for further use.
- TLS 1.3 Support: The implementation of TLS 1.3, improves the transport security of Java applications.
Running Java Files Directly (JEP 330)
In Java 11, you can now run a single-file Java source code using the java
launcher without having to explicitly compile it. This feature simplifies the execution of small Java programs, allowing engineers to quickly write and test ideas.
Consider the following simple example, saved in a file named HelloWorld.java
:
public class HelloWorld…