English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Java Basic Tutorial

Java flow control

Java array

Java object-oriented (I)

Java object-oriented (II)

Java object-oriented (III)

Java Exception Handling

Java List

Java Queue (queue)

Java Map collection

Java Set collection

Java input/output (I/O)

Java Reader/Writer

Java other topics

Java 9 New features

Java 9 was released on 2017 year 9 month 22 On the day, it brought many new features, the most significant change being the implementation of the modular system. Next, we will introduce Java 9 new features.

Java 9 New features

  • Module System: a module is a container for a package, Java 9 One of the biggest changes is the introduction of the module system (Jigsaw project).

  • REPL (JShell): interactive programming environment.

  • HTTP 2 client: HTTP/2standard is the latest version of the HTTP protocol, and the new HTTPClient API supports WebSocket and HTTP2 stream and server push features.

  • Improved JavadocJavadoc now supports searching within API documentation. In addition, the output of Javadoc now conforms to the latest version of the HTTP protocol, and the new HTTPClient API supports WebSocket and HTTP5 Standard.

  • Multi-version Compatible JAR Packages: Multi-version compatibility JAR feature allows you to create libraries that run only in specific versions of the Java environment and choose to use the class version.

  • Collection Factory Methods: New static factory methods in the List, Set, and Map interfaces can create immutable instances of these collections.

  • Private Interface Methods: Use private private methods in the interface. We can use the private access modifier to write private methods in the interface.

  • Process API: Improved API to control and manage operating system processes. Introduces java.lang.ProcessHandle and its nested interface Info to allow developers to escape the predicament of having to use local code to obtain the PID of a local process.

  • Improved Stream API: The improved Stream API adds some convenient methods to make stream processing easier and use collectors to write complex queries.

  • Improved try-with-resources: If you already have a resource that is final or equivalent to a final variable, you can use try-with-Use the variable in the resources statement without needing to use try-with-Declare a new variable in the resources statement.

  • Improved Deprecated annotation @Deprecated: The annotation @Deprecated can mark the status of Java API, indicating that the marked API will be removed or has been broken.

  • Improved Diamond Operator : Anonymous classes can use the diamond operator (Diamond Operator).

  • Improved Optional class: java.util.Optional has added many new useful methods, and Optional can be converted directly to stream.

  • Multi-resolution Image API: Defines multi-resolution image API, allowing developers to easily operate and display images of different resolutions.

  • Improved CompletableFuture API : The asynchronous mechanism of CompletableFuture class can execute operations when the ProcessHandle.onExit method exits.

  • Lightweight JSON API: It includes a lightweight JSON API

  • Reactive Streams API: Java 9introduces a new reactive stream API to support Java 9 in the responsive programming.

More new features can be found on the official website:What's New in JDK 9

JDK 9 Download address:http://www.oracle.com/technetwork/java/javase/downloads/jdk9-doc-downloads-3850606.html

About Java 9 In the examples of this article, we all use jdk 1.9 environment, you can use the following command to view the current jdk version:

$ java -version
java version "9-ea"
Java SE Runtime Environment (build 9-ea+163)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+163, mixed mode)

Next, we will introduce Java in detail to everyone 9 New Features:

NumberFeatures
1Module System
2REPL (JShell)
3Improved Javadoc
4Multi-version Compatible JAR Packages
5Collection Factory Methods
6Private Interface Methods
7Process API
8Stream API
9try-with-resources
10@Deprecated
11Diamond Operator in Inner Classes
12Optional Class
13Multi-resolution Image API
14CompletableFuture API