Skip to content

Java 11 new Features

  • Java Evolution: 9 to 11 https://chatgpt.com/c/8cbcbca6-603c-4831-9da3-54bf9eb49bd5
  • Java 11 - Http Client : https://chatgpt.com/c/bfa71868-583f-471e-aa68-34c3c207fe0d
  • https://chatgpt.com/c/4dd4601b-75ba-473c-93fb-48626341df24

Java 9

  1. JShell: A Read-Eval-Print Loop (REPL) tool.
    1. Module System (Project Jigsaw): for better modularizing of code, help to encapsulate packages.
  2. Interfaces Enhancement : private methods.
  3. try-with-resources statement.
  4. Stream API Enhancements: takeWhile, dropWhile
  5. Optional:
  6. ifPresentOrElse(Consumer,Runnable)
  7. stream()
  8. isEmpty()
  9. Diamond Operator Enhancement:
  10. Allows the diamond operator to be used with anonymous classes.
  11. @Deprecated(forRemoval=true) : annotation to indicate they will be removed in future releases.
  12. new HTTP/2 Client: HTTP/2 and WebSocket protocol support.
  13. Compact Strings in Java 9:

    • compact strings were introduced to improve memory usage for strings
    • that only contain Latin-1 characters (ISO-8859-1).
    • These strings are represented as byte arrays internally instead of char arrays, saving memory.
  14. More:

  15. Multi-Resolution Image API: An API for working with images at different resolutions.
  16. Process : Improved API for managing and controlling operating system processes.
  17. Multi-Release JARs: Allowed a single JAR to support multiple versions of Java.

Java 10,11

  1. Allows running a Java source file as a script.
  2. Allowed running a single-file program without compilation (java MyClass.java).
  3. Local-Variable Type Inference (var):
  4. Allows the type of local variables to be inferred by the compiler.
  5. use of var in lambda expressions.
    1. Nest-Based Access Control:
    2. access the private member of nested class.
    3. had to use reflection API before.
  6. TLS 1.3 protocol support.

  7. internal improvements:

  8. Parallel Full GC for G1: G1 garbage collector now supports full GC parallelism.
  9. Application Class-Data Sharing: Improves startup time and reduces memory footprint by sharing common class metadata across JVM instances.
    • Heap Allocation on Alternative Memory Devices : Experimental support for allocating the Java object heap on alternative memory devices.
  10. Epsilon: A no-op garbage collector, useful for performance testing and short-lived jobs.
  11. Root Certificates: Open-source root certificates to improve the OpenJDK build process.

  12. Flight Recorder: tools

  13. A low-overhead data collection framework for troubleshooting and profiling.