Java 10 Features (Released March 2018)

Java 10 was a short-term release but introduced some useful enhancements:

  1. Local Variable Type Inference (var)
    • Enables you to declare local variables without explicitly specifying the type.
    • Example:
      var name = "Java";
      var list = List.of(1, 2, 3);
      
    • Improves code readability and reduces verbosity.
  2. Garbage Collector (GC) Improvements
    • Introduced G1 Garbage Collector optimizations for better performance.
    • Allowed parallel processing during memory reclamation.
  3. Application Class-Data Sharing
    • Reduces startup time and memory footprint by sharing class metadata between applications.
  4. Thread-Local Handshakes
    • Improves how threads interact, allowing faster execution for small tasks.

Java 11 Features (Released September 2018)

Java 11 was a long-term support (LTS) release, meaning it receives updates for a longer duration. It introduced several key improvements:

  1. New HTTP Client API (Finalized)
    • Initially introduced in Java 9, now officially part of the standard API.
    • Supports modern web protocols, including HTTP/2 and WebSockets.
  2. String API Enhancements
    • New useful methods such as:
      " Java ".strip(); // Removes whitespace
      "hello".repeat(3); // Outputs: hellohellohello
      
    • Improves efficiency in handling text operations.
  3. Lambda Parameter var Support
    • Allows using var inside lambda expressions:
      (var x, var y) -> x + y;
      
  4. Removal of Java EE and CORBA Modules
    • Simplifies the Java runtime by removing outdated technologies.
  5. Launch Single-File Programs Without Compilation
    • Run a .java file directly without compiling:
      java HelloWorld.java
      

Java 11 brought valuable updates, especially for enterprise applications due to its LTS status.