Javarevisited

A humble place to learn Java and Programming better.

Follow publication

Member-only story

JAVA-RELEASE/JAVA-11

Java 11 [LTS]: Features and Highlights

This article covers features of Java 11 with code examples

Pravinkumar Singh
Javarevisited
Published in
7 min readJun 15, 2023

image by @iampravo

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

  1. Running Java files directly: Enhancements to java launcher allowing direct execution of single-file Java source code without explicit compilation.
  2. Improved var handling: Improved type inference for lambda expressions using var.
  3. HTTP Client API: The introduction of a standard HTTP Client API supporting HTTP/1.1, HTTP/2, and WebSocket communication.
  4. String Functions: New utility methods added to the String class, such as repeat(), isBlank(), strip(), lines().
  5. New Epsilon Garbage Collector: A no-op garbage collector to test the performance of applications.
  6. Java Flight Recorder (JFR) Event Streaming: The JFR now supports event streaming, providing more capabilities for monitoring and profiling Java applications.
  7. Eliminating Nashorn JavaScript Engine: The removal of the Nashorn JavaScript engine and associated API, making it unavailable for further use.
  8. 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

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

No responses yet

Write a response