Java 16 is released with 17 features and updates – Check Java 16 Features here

5057

Oracle releases Java 16 JDK and virtual machine with 17 features for the production use. Java 16 brings host of new features and improvements. Last year Java 15 was released and after an interval of 1 year Java 16 has been released. Now, the support for Java 15 will end with the release of Java 16, developers using Java 15 is advised to move their applications to use Java 16.

Originally Java 16 was scheduled to be released in November 2020, but due to substantial changes the release date was pushed and now it is released on March 16. The general availability (GA) release of the Java 16 Platform (Java SE 16) is now released along with the Oracle’s Java Development Kit (Oracle JDK). Developers can use OpenJDK 16 or Oracle Java for developing and deploying their applications.

The Java 16 is a short term release of Java which will become obsolete at the time of release of Long Term Support (LTS) release of upcoming Java 17. The Java 17 is expected to release in September this year (2021). Java 17 will be a long term supported version of JDK and it will be supported by Oracle for a longer period.

Java 16 comes with lots of enhancements and upgrades, that includes support of Pattern Matching while using instanceof; Records, previewed in Java 14. In also includes a new Packaging Tool, incubating versions of the Vector API, the Foreign Linker API, and the Foreign-Memory Access API.

Java 16 also features Sealed Classes, which is a preview feature in this version of Java and can be included into the future versions of Java.

Here is the complete list of new features of Java 16:

Vector API (Incubator)

The Vector api jdk.incubator.vector is now part of Java 16, which can be used for vector computations reliably on the CPU.

Enable C++14 Language Features

Now in Java 16 the use of C++14 language features is allowed, and it can be used to specify the specific guidance which may be used in HotSpot code.

Migrate from Mercurial to Git

Now the source code of the OpenJDK Community’s is migrated from Mercurial (hg) to Git.

ZGC, Concurrent Thread-Stack Processing

Java 16 Moves ZGC thread-stack processing from safepoints to a concurrent phase and it is another major feature of Java 16.

Unix-Domain Socket Channels

Java 16 added Unix-domain (AF_UNIX) socket support to the socket channel and server-socket channel APIs in the java.nio.channels package. In this version of Java the inherited channel mechanism to support Unix-domain socket channels and server socket channels is also added.

Alpine Linux Port

The Java 16 is also ported to Alpine Linux, and to other musl based Linux distributions.

Elastic Metaspace

Java 16 is updated and now it returns unused HotSpot class-metadata (i.e. metaspace) memory to the operating system more promptly. This is good and it reduces metaspace footprint, and simplify the metaspace code. This feature reduce maintenance costs.

Windows/AArch64 Port

Now Java 16 comes with the ports to Windows/AArch64.

Foreign Linker API (Incubator)

Java 16 introduces Foreign Linker API which is Incubator state and offers statically-typed, pure-Java access to native code.

Warnings for Value-Based Classes

In Java 16 warnings for Value-Based Classes is added.

Packaging Tool

Java 16 provides the jpackage tool, which can be used for packaging self-contained Java applications.

Foreign-Memory Access API (Third Incubator)

The foreign-memory access API is introduced in Java 16 and its in incubator stage.

Pattern Matching for instanceof:

The pattern matching is introduced with the instanceof operator, which means developers can use pattern matching while using this function.

Records

Java 16 enhances the support for Records which allows the Java programmers to develop application which uses classes as transparent carriers for immutable data. In Java 16 records can be thought of as nominal tuples.

Strongly Encapsulate JDK Internals by Default

Java 16 now strongly encapsulates all internal elements of the JDK, but critical internal APIs such as sun.misc.Unsafe are not encapsulated. Although it allows the users to choose the relaxed strong encapsulation. This default encapsulation features was added in JDK 9.

Sealed Classes (Second Preview)

The Sealed Classes are in second preview in the Java 16. Sealed classes and interfaces are powerful feature in Java 16 which restricts the other classes or interfaces to extend or implement the sealed classes.

Learning Java programming is now very easy, check Java Tutorials to learn Java quickly.