Java 10 features

Here we are discussing the top 10 features of Java 10 programming language which is released in 2018.

Java 10 features

Here we are discussing the top 10 features of Java 10 programming language which is released in 2018.

Java 10 features

Top 10 new features of Java 10

In this article we are going to explore about the top 10 new features of Java 10 and also see some of the examples. Java 10 is short term release of Java and it is released with many new features. Java 10 was on released in March 2018 as short term release and its end of life (support) is in Sep 2018 with the release of Java 11.

As planned earlier, Oracle released Java 10 on time in March 2018. Oracle is trying to release all the future versions of Java on time and as per schedule. Next version of Java is Java version 11 which is expected to be released somewhere in September 2018. Java 11 will be released with the long term support.

Let's discuss the top 10 features of Java 10:

1. Local Variable Type

The introduction of Local Variable Type is the most interesting feature which is added with this release of Java 10 to improve the experience of developers. It introduces a keyword var, which used to define a variable in the program and its type is determined by the data type assigned to it. The compilers infers the data type based on the data assigned to the variable define by the var keyword.

Java 10 Features

Here is example:

var list = new ArrayList<String>();

Above code declares a variable using the var keyword.

2. Garbage Collector Interface

Java 10 introduced a clean interface for garbage collection, which allows to quickly new implementation of garbage collection. This allows excluding default GC from the JDK build and use another implementation of garbage collection. New change will help in developing garbage collection implement based on particular application usage pattern and all is done without affecting the existing code base.

3. Parallel Full GC for G1

In this released full GC is changed to execute in parallel and this improves the G1 worst-case latencies. In this case the number of threads can be controlled by the following option parameter:

-XX:ParallelGCThreads

This change was made to match the performance of the parallel collector's full GC in all scenarios.

4. Support for heap allocation on alternative memory devices

This change allows the developers to use the alternative memory devices to store the objects. The alternative memory devices can be any non-DRAM devices for storing less priority objects and it will also decrease total cost of the system. Application can be designed to use alternative memory devices for low priority objects and RAM for high priority objects. This change will also help in decreasing the cost of memory in the system.

5. Consolidation of repositories for JDK 10

In JDK version 10 all the separate code repositories are combined into one repository and this change is more related to housekeeping. This makes the management of code base much easier and in a once code base.

6. Root Certificates

JDK 10 comes with a default set of root Certification Authority (CA) certificates. This aims to reduce the difference between OpenJDK and Oracle JDK builds.

7. Experimental Java-Based JIT Compiler

JDK 10 introduced Graal compiler research project and its a Java-Based JIT compiler. This feature is experimental stage and should not be used in production.

8. Thread-Local Handshakes

JDK 10 introduced Thread-Local Handshakes feature which provides a way to execute a call-back on threads without performing a global VM safe point. This change enables stop individual threads and not just all threads or none.

9. Removal of Native-Header Generation Tool

JDK 10 removed javah header generation tool from the JDK as it is not required to generate headers any more. Codebase is combined and all can be compiled with the javac tool when compiling JNI code.

10. Time-Based Release Versioning

Now JDK will be released with the version string like JDK 9.0.1, JDK 9.0.2, JDK 9.0.3 etc.. The current version of JDK 10 is Java SE Development Kit 10.0.1.

In this section we have discussed the top new features of JDK 10. As reminder JDK 11 is going to release in Sep - 2018.

You can more Java tutorials at: