Java 9

Java 9 – Overview

Java 9 is the most awaited and is a major feature release of Java programming language. This is an introductory tutorial that explains the basic-to-advanced features of Java 9 and their usage in a simple and intuitive way.

This tutorial will be useful for most Java developers, starting from beginners to experts. After completing this tutorial, you will find yourself at a moderate level of expertise in Java 9, from where you can take yourself to next levels.

Prerequisites

Knowledge of basic Java programming language is the only prerequisite for learning the concepts explained in this tutorial.

JAVA 9 (aka jdk 1.9) is a major release of JAVA programming language development. Its initial version was released on 21 Sep 2017. The main goals of Java 9 release are −

  1. To make JDK and Java Standard Edition platform modular based in the sense that it can be scalled down to small computing devices well.
  2. To improve the overall security of the JDK and Java Implementations.
  3. To make build process and maintainance of java code libraries and large applications easy for for JAVA SE and EE platforms.
  4. To design and implement a standard module system for the Java Platform which can be applied on both Platform and JDK easily.

New Features

There are 90+ enhancements added to Java 8, the most significant ones are mentioned below −

  1. Module − A new kind of Java programing component introduced as module, which is a named, self-describing collection of code and data.
  2. REPL (JShell) − Read-Eval-Print Loop (REPL) capability added to the Java platform.
  3. HTTP 2 Client − new HTTPClient API supporting websockets and HTTP 2 streams and server push features.
  4. Improved JavaDocs − Supports HTML5 output generation. Provides a search box to generated API documentation.
  5. Multirelease JAR − Enhances the JAR format so that multiple, Java release-specific versions of class files can coexist in a single archive.
  6. Collection Factory Methods − New static factory methods for List, Set, and Map interfaces to create immutable instances of those collections.
  7. Private Interface Methods − Enhanced interfaces with private and private static methods.
  8. Process API Improvements − Improved API to control and manage operating system processes.
  9. Stream API Improvements − Enhanced security and robustness by allowing incoming streams of object-serialization data to be filtered.
  10. Try With Resources improvement − Now final variables can be used as resources in the try-with-resources statement.
  11. Enhanced @Deprecated Annotation − @Deprecated annotation revamped to provide more information about the status and intended disposition of an API.
  12. Inner Class Diamond Operator − Allow the diamond operator to be used with anonymous classes if the argument type of the inferred type can be denoted.
  13. Optional Class Improvements − New useful methods are added to java.util.Optional class.
  14. Multiresolution Image API − Supports encapsulation of a set of images with different resolutions into a single multiresolution image.
  15. CompletableFuture API improvements − The asynchronous mechanisms of the CompletableFuture class can perform an action when the process exits with ProcessHandle.onExit method.
  16. Lightweight JSON − A lightweight API introduced to consume and generating documents and data streams via json in java 9.
  17. Reactive Streams API − A new Reactive Streams API in Java SE 9 has been introduced to support reactive programming in java 9.

About the Author: Elavarasan PK

Technical Specialist, Intersoft Data Labs