You are here
Home > java > Core Java >

Java Features After Java 8

Java Features After Java 8After Java 8, Java 9 has big changes & new features. Here in this section we will talk about Java Features After Java 8. If you are preparing for a Java developer interview, there are 100% chances that, you will find some questions about this topic. This article may work as a refresher for the interview.

You can learn about Java 8 Features from a separate article. We will update this article on a regular basis in case of a release of the new version. Let’s discuss Java Features After Java 8.

Java Features After Java 8

After Java 8, several new features were introduced in subsequent versions. Here are some key features introduced in Java after Java 8. Let’s check them one by one.

New In Java 9

Let’s start our topic ‘Java Features After Java 8’ with New Features in Java 9.

1) Java Platform Module System : Jigsaw Project
2) JShell Command Line Tool
3) Private Methods in Interfaces
4) Diamond Operator Extension
5) Improvements in Stream API
6) Introduction of  Factory Method of() for creating a Collection.
7) Small Modifications in Try-With-Resources
8) Мulti-Resolution Image API
9) HTTP 2 Client ( A new Client)
10) Platform and JVM Logging
11) Process API Updates
12) Multi-release JAR Files
13) @Deprecated Tag Changes
14) Stack Walking

New In Java 10 

1. Local Variable Type Inference : var x=10; allowed but var is not a keyword

var map= new HashMap<String,List<String>>(); is valid
var stream; is valid
var path = Paths.get(filename); is valid
var numbers= List.of(1, 4.5,”Java”); is valid

var s =null is not allowed.
var can’t be defined at class level, can’t be assigned to Lambda expression but can be defined inside lambda expression.

2. has new method Collectors.unmodifiableList() to control list from modification. Similarly for Set & Map as well.

java.util.List, java.util.Map and java.util.Set each got a new static method copyOf(Collection). It returns the unmodifiable copy of the given Collection. An attempt to modify such a collection would result in java.lang.UnsupportedOperationException runtime exception.

3. Optional.orElseThrow() : 

java.util.Optionaljava.util.OptionalDoublejava.util.OptionalInt and java.util.OptionalLong, each got a new method orElseThrow() which doesn’t take any argument and throws NoSuchElementException if no value is present:

4. Garbage collector changes
5. Some methods deprecated.

Note: Java 10 was the last free Oracle JDK release that we could use commercially without a license. Starting with Java 11, there’s no free, long-term support (LTS) from Oracle.

New In Java 11

Now let’s talk about New In Java 11 under the article ‘Java Features After Java 8’.

Note that starting from Java 11, Oracle has updated the license term to use only for developing, testing, prototyping, demonstrate your application. You may not use the programs for data processing or any commercial, production or any internal business purposes.
Subscription plan was already in place on yearly or one time payment basis, but they have given the option of monthly subscription now.
In summary Java is free for personal & non-commercial use always.

Added Features:

1. Collection.toArray(IntFunction) default method : The java.util.Collection interface got a new default toArray() method which takes an IntFunction argument in order to make it easier to create an array of the right type from a collection.

2. Local-variable syntax for Lambda Parameters : Usage of var keyword in lambda parameters started from Java 11.

3. Some new methods to the String class: isBlank()lines()strip()stripLeading()stripTrailing(), and repeat(). Undoubtedly, these methods will minimize the amount of boilerplate code used in manipulation of string objects, and save developers from importing various libraries.

4. New File Methods : Files class got new static methods readString() and writeString() in order to read and write Strings from files.

5. The ‘not()’ Predicate Method : The Predicate Interface has got a static not() method to negate an existing predicate.

6. Running Java source File directly without compile :  Starting from Java 11, we don’t need to compile the Java source files with javac explicitly anymore. Instead, we can directly run the file using the java command.

Removed features :

1. Com.sun.awt.AWTUtilities class : it was deprecated since jdk8
2. appletViewer Launcher
3. Thread.destroy() & Thread.stop(Throwable)
4. Java EE & CORBA modules

New In Java 12

1. Switch-case Statement : multiple entries allowed as case input

String input=”Monday”;
switch(input) {
case “Monday”, "Tuesday”,”Wednesday”, “Thursday”, “Friday” ->System.out.println(“Week days”);
case “Saturday”, “Sunday” -> System.out.println(“Weekends”);
default -> System.out.println(“Invalid days”);


2. String literal : HTML code can also be included without any \n character.

String html= “<html>
<p>Hello World.</p>

3. String Class new Methods : indent() and transform()

indent() method is used to adjust the indentation of each line on the basis of the integer parameter passed to it. If the parameter is positive integer (greater than zero), new spaces will be inserted at the beginning of each line. On the other hand, if the parameter is negative integer (less than zero), it removes spaces from the begging of each line.

transform() accepts a single argument function as a parameter that will be applied to the string.

4. File mismatch() method : The nio.file.Files utility class has got a new mismatch() method in order to compare two files and find the position of the first mismatched byte in their contents.

5. Other Garbage Collector & Performance Improvements

New In Java 13 

In continuation to ‘Java Features After Java 8’, it’s time to talk about new features in Java 13.

1. Yield keyword in Switch-case Statement : If we use colon (:) operator, we need to use yield keyword as shown in below code snippet.

String input=”Monday”;
switch(input) {
case “Monday”, "Tuesday”,”Wednesday”, “Thursday”, “Friday” : yield System.out.println(“Week days”);
case “Saturday”, “Sunday” : yield System.out.println(“Weekends”);
default : yield System.out.println(“Invalid days”);


2. Text block : will be printed exactly as it is written: introduced with triple quote “”” . Now JSON format code can also be inserted without any special character.

String html= “””<html>
<p>Hello World.</p>

3. Other performance related changes

New In Java 14

We have a detailed discussion for Java 14 features in a separate article.

Please visit Java 14 Features

New In Java 15

Please visit Java 15 Features

New In Java 16

Vector API
Enable C++14 Language Features
Migrate from Mercurial to Git
Migrate to GitHub
Concurrent Thread-Stack Processing
Unix-Domain Socket Channels
Alpine Linux Port
Elastic Metaspace
Windows/AArch64 Port

New In Java 17

Please check Java 17 Features

New In Java 18

Pattern Matching for Switch
Improvements to Javac Compiler
Expand Checks of Javac’s Serial Lint Warning in the newest version of Java
Code Snippets in Java API Documentation
String Deduplication
Finalization Deprecated for Removal
Internet-Address Resolution SPI
Simple Web Server

New In Java 19

New System Properties for System.out and System.err
Additional Date-Time Formats
New Methods to Create Preallocated HashMaps and HashSets
Windows KeyStore Updated to Include Access to the Local Machine Location
Support Unicode 14.0
Automatic Generation of the CDS Archive
Support for PAC-RET Protection on Linux/AArch64
HTTPS Channel Binding Support for Java GSS/Kerberos
Add a -providerPath Option to jarsigner
New Options for ktab to Provide Non-Default Salt

Deprecated Features & Options In Java 19

java.lang.ThreadGroup Is degraded (Under core-libs/java.lang)
Deprecation of Locale Class Constructors (Under core-libs/java.util:i18n)
PSSParameterSpec(int) Constructor and DEFAULT Static Constant Are Deprecated (Under security-libs/
OAEPParameterSpec.DEFAULT Static Constant Is Deprecated (Under security-libs/javax.crypto)

New In Java 20

Scoped Values (Incubator)
Record Patterns (Second Preview)
Pattern Matching for switch (Fourth Preview)
Foreign Function & Memory API (Second Preview)
Virtual Threads (Second Preview)
Structured Concurrency (Second Incubator)
Vector API (Fifth Incubator)

For complete details, please visit official website JDK 20 New Features.

New In Java 21

String Templates (Preview)
Sequenced Collections
Generational ZGC
Record Patterns
Pattern Matching for switch
Foreign Function & Memory API (Third Preview)
Unnamed Patterns and Variables (Preview)
Virtual Threads
Unnamed Classes and Instance Main Methods (Preview)
Scoped Values (Preview)
Vector API (Sixth Incubator)
Deprecate the Windows 32-bit x86 Port for Removal
Prepare to Disallow the Dynamic Loading of Agents
Key Encapsulation Mechanism API
Structured Concurrency (Preview)

For complete details, please visit official website JDK 21 New Features.

New In Java 22

Unnamed Variables & Patterns
Statements before super (…) [Preview]
String Templates (Second Preview)
Implicitly Declared Classes and Instance Main Methods (Second Preview)
Foreign Function & Memory API
Class-File API (Preview)
Stream Gatherers (Preview)
Structured Concurrency (Second Preview)
Scoped Values (Second Preview)
Vector API (Seventh Incubator)
Region Pinning for G1
Launch Multi-File Source-Code Programs

For detailed explanation, please visit a separate article on Java 22 New Features. Also, visit official website for JDK 22 New Features.

We will extend our topic ‘Java Features After Java 8’ with further explanation of existing facts when necessary.




Leave a Reply