← Back to list

Summary of changes from Java 9 to 15: A Journey of Java’s Evolution

Photo by Eugene Zhyvchik on Unsplash

Alankar Gupta · 2024-08-25 08:35 · 0 claps · 4.4 min read
#java #java9 #java10 #java11 #java12
Open on Medium ↗
Wiki topics: 🥊 · Combat Sports

Summary of changes from Java 9 to 15: A Journey of Java’s Evolution

Photo by Eugene Zhyvchik on Unsplash

Photo by Eugene Zhyvchik on Unsplash

Java, a cornerstone of modern software development, has continuously evolved to meet the demands of a dynamic technological landscape. The journey from Java 9 to Java 11 is particularly significant, marked by a series of enhancements that have refined the language’s capabilities, boosted performance, and streamlined development workflows.

In this blog, we’ll delve into the key differences between Java versions 9 to 11, with each section dedicated to exploring the new features introduced in a specific Java version. We’ll illustrate these features with concise code examples and provide a summary to solidify your understanding.

Java 9: Modularity and Beyond

Key Feature: Java Platform Module System (JPMS)

module com.mymodule {
    requires java.base;
    exports com.mymodule.api;
}

Summary:

JPMS brought modularity to Java, allowing developers to encapsulate code into self-contained units with explicit dependencies. This promotes better code organization, maintainability, and scalability, particularly for large projects.

Additional Java 9 Features:

  • JShell (Read-Eval-Print Loop): An interactive tool for evaluating Java code snippets in real-time, aiding in experimentation and learning.
  • Collection factory methods: Convenient methods like List.of() and Set.of() to create immutable collections with ease.
  • Private interface methods: Allows interfaces to define private methods for internal implementation details, improving code organization.
  • HTTP/2 client: A new HTTP client with support for HTTP/2, offering improved performance and efficiency for network communication.
  • Process API improvements: Enhancements to the Process API for better control and management of operating system processes.

Java 10: Local Variable Type Inference

Key Feature: var keyword

var list = new ArrayList<String>();
list.add("Hello");

Summary:

var enables type inference for local variables, reducing boilerplate code and enhancing readability. The compiler infers the variable's type from the initializer expression.

Additional Java 10 Features:

  • Garbage Collector Interface: A standardized interface for garbage collectors, allowing easier integration of new GC implementations.
  • Parallel Full GC for G1: Improves G1 garbage collector’s performance by parallelizing full garbage collections.
  • Application Class-Data Sharing: Reduces startup time and memory footprint by sharing common class metadata across multiple JVM instances.
  • Thread-Local Handshakes: A mechanism for performing callbacks on threads without the need for global VM safepoints.

Java 11: Long-Term Support and Key Enhancements

Key Features:

  • HTTP Client (Standard)
  • Single-File Source-Code Programs
  • String Methods (isBlank, lines, repeat, strip)
  • Epsilon Garbage Collector
  • Dynamic Class-File Constants
  • Local-Variable Syntax for Lambda Parameters
var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
        .uri(URI.create("https://www.example.com"))
        .build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

Summary:

Java 11 is a Long-Term Support (LTS) release, signifying its extended support and stability. It introduces a standardized HTTP client, streamlines running single-file programs, enhances String manipulation, and adds performance optimizations with the Epsilon Garbage Collector.

Additional Java 11 Features:

  • Flight Recorder: A low-overhead data collection framework for monitoring and profiling JVM and application behavior.
  • Nest-Based Access Control: Improves encapsulation and security by allowing classes within a nest to access each other’s private members.
  • Low-Overhead Heap Profiling: Provides detailed information about object allocation and memory usage with minimal performance impact.

Java 12: Switch Expressions (Preview) and Shenandoah GC

Key Feature: Switch Expressions (Preview)

int dayOfWeek = 3;
String dayType = switch (dayOfWeek) {
    case 1, 7 -> "Weekend";
    case 2, 3, 4, 5, 6 -> "Weekday";
    default -> throw new IllegalArgumentException("Invalid day   
 of week: " + dayOfWeek);
};
System.out.println(dayType); // Output: Weekday

Summary:

Switch expressions offer a more concise and expressive way to write switch statements, allowing them to be used as expressions and returning values directly.

Additional Java 12 Features:

  • Shenandoah GC (Experimental): A low-pause-time garbage collector designed for large heaps.
  • Microbenchmark Suite: A collection of microbenchmarks for measuring JVM performance.
  • JVM Constants API: An API to model nominal descriptions of key class-file and run-time artifacts, in particular constants that are loadable from the constant pool.

Java 13: Text Blocks (Preview) and ZGC Enhancements

Key Feature: Text Blocks (Preview)

String html = """
    <html>
        <body>
            <p>Hello, world!</p>
        </body>
    </html>
    """;

Summary:

Text blocks simplify the creation of multi-line strings, preserving formatting and eliminating the need for escape sequences.

Additional Java 13 Features:

  • ZGC Enhancements: Improvements to the Z Garbage Collector, including uncommitting unused memory and returning it to the operating system.
  • Socket API Reimplementation: A new implementation of the java.net.Socket and java.net.ServerSocket APIs for better performance and maintainability.
  • Dynamic CDS Archives: Allows the creation of class-data sharing (CDS) archives at runtime, improving startup time.

Java 14: Pattern Matching for instanceof (Preview) and Helpful NullPointerExceptions

Key Feature: Pattern Matching for instanceof (Preview)

if (obj instanceof String s) {
    System.out.println(s.length());
}

Summary:

Pattern matching enhances the instanceof operator, allowing you to declare a variable within the pattern and use it directly in the conditional block, reducing boilerplate code.

Additional Java 14 Features:

  • Helpful NullPointerExceptions: Provides more informative NullPointerExceptions, pinpointing the exact location of the null reference.
  • Records (Preview): A new type of class for modeling data aggregates with concise syntax.
  • Foreign-Memory Access API (Incubator): An API for accessing off-heap memory safely and efficiently.

Java 15: Sealed Classes (Preview) and Text Blocks (Standard)

Key Features:

  • Sealed Classes (Preview)
  • Text Blocks (Standard)
  • Hidden Classes
  • Edwards-Curve Digital Signature Algorithm (EdDSA)
  • Foreign-Memory Access API (Second Incubator)
sealed class Shape permits Circle, Rectangle { }
final class Circle extends Shape { /* ... */ }
final class Rectangle extends Shape { /* ... */ }

Summary:

Sealed classes and interfaces restrict which other classes or interfaces can extend or implement them, providing better control over inheritance hierarchies. Text blocks, introduced as a preview in Java 13, are now a standard feature.

Additional Java 15 Features:

  • Hidden Classes: Improve the efficiency of frameworks that generate classes at runtime.
  • Edwards-Curve Digital Signature Algorithm (EdDSA): A new cryptographic algorithm for digital signatures.
  • Foreign-Memory Access API (Second Incubator): Continued development of the API for accessing off-heap memory.

Photo by yash rai on Unsplash

Photo by yash rai on Unsplash

Conclusion

The evolution from Java 9 to 15 has brought significant advancements to the language, empowering developers with enhanced tools, performance improvements, and a more streamlined development experience. Understanding these key differences equips you to leverage the full potential of Java in your projects, ensuring your code remains modern, efficient, and maintainable.

Remember, continuous learning is key in the ever-evolving world of technology. Embrace the new features, experiment with them, and continue your journey of Java mastery.


메타데이터
post_id
de1e03ba2ace
slug
summary-of-changes-from-java-8-to-15-a-journey-of-javas-evolution-de1e03ba2ace
url
https://medium.com/@alankarrocks/summary-of-changes-from-java-8-to-15-a-journey-of-javas-evolution-de1e03ba2ace
canonical_url
https://medium.com/@alankarrocks/summary-of-changes-from-java-8-to-15-a-journey-of-javas-evolution-de1e03ba2ace
author_url
https://medium.com/@alankarrocks
status
ok
fetched_at
2026-07-23 01:32:44