Home » Core Java » Java 8 vs Java 10

About Sergio Lauriano Junior

Sergio is graduated in Software Development in the University City of São Paulo (UNICID). During his career, he get involved in a large number of projects such as telecommunications, billing, data processing, health and financial services. Currently, he works in financial area using mainly Java and IBM technologies.

Java 8 vs Java 10

In this article, we’re going to present Java 8 vs Java 10. Specifically, we are going to compare features and tools introduced in both versions.

1. Introduction

Java is a programming language, object-oriented based, first introduced in 1995 by James Gosling at Sun Microsystems. In January 2010, Oracle Corporation acquired Sun Microsystems and since then they maintain and evolve the Java language.

It is a general-purpose programming language, intended to let application developers Write Once, Run Anywhere (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.

In the next sections, we’ll see features and tools present on versions 8 and 10 of Java. Currently, Java is on the 16 version.

java 10 vs java 8

2. Java 8 Features

Java 8 brought a big change to the Java language. The enhancements give a new approach to the Java environment, that makes Java supports functional programming from this version and beyond.

Following, I selected some important features that we can take a look.

2.1 Lambda Expressions

The Lambda Expressions are introduced in Java 8 to evolve the language in the functional programming paradigm. Also, in this version, we can say Java is now a multi-paradigm programming language, incorporating more tools to make easier coding.

Before Java 8, to instantiate a class, we had to write an anonymous inner class like that:

Using traditional way
Runnable runnable = new Runnable(){
       public void run(){
         System.out.println("Hello world classic!");

Now, with lambda expression:

Using lambda expression
Runnable runnable = () -> System.out.println("Hello world lambda!");

Simpler and easier.

2.2 Collections and Streams

The Stream API brings a lot of functions and tools to work with elements from creation to handling. For instance, when we worked with data collections (lists, maps, arrays), we usually need to do loops to iterate.

List example
List list = Arrays.asList("john", "paul", "george", "ringo");

Using Stream API, we just need few coding lines to work with the list:

Sorting using Stream

The API has several other methods for sorting, iterating, calculations, etc… Above all, this makes Stream API one great feature for Java language evolution.

Check the complete list of features here.

3. Java 10 features

Java 10 has few enhancements compared with Java 8 and 9. However, it keeps the features introduced in Java 9 and I highlight them on the following.

3.1 JShell

Starting on Java 9, JShell is the REPL (Read-Evaluate-Print-Loop) tool for Java language. Now, Java has a shell console for users to test some code without need and IDE or compile code.

JShell console
$ jshell
|  Welcome to JShell -- Version 10.0.2
|  For an introduction type: /help intro

jshell> int x = 10;
x ==> 10

jshell> x > 0;
$2 ==> true


3.2 Java Modules – Project Jigsaw

The Project Jigsaw came in Java 9 and brings the modularity to the Java platform.

In summary, modularity makes it easier for developers to construct and maintain libraries
and large applications. Moreover, this project was implemented under the OSGi specification.

3.3 LocalVariable Type Inference

Here we have a real Java 10 feature. Until Java 9, we must explicitly mention the type of the local variable and ensure that it was compatible with its initializer.

Initializing variable using old way
String message = "Good bye, Old local var";

Java 10 introduces the “var” keyword, also called local-variable type inference.

Using local-variable type inference
var message = "Hello, Java 10";

This feature only applies for local variables inside methods. Be careful on its use.

Java 10 also has other features that you can check the complete list of here. Also, Java 9 features that keep in Java 10 can be consulted in this link.

4. Java 8 vs Java 10: Head-to-Head Comparison

Basically, Java keeps features from older versions until the newer versions, deprecating some features when is need. However, I made the following comparison to make it easier to know what is different between these two versions:

Support to functional programmingxx
GNU Licensexx
Long Term Support (LTS)x
REPL consolex
Local-variable type inferencex
Modular systemx

5. What do I have to install?

Since Java is a WORA technology (Write Once Run Anywhere), you can work with Java 8 and 10 in your development environment.

Also, Java 10 has the same features as Java 8, so you can keep your legacy code from previous Java versions that will work properly on a newer version.

Find below both version to download and install on your computer.

I also advise using an IDE to work with Java programming. I use IntelliJ nowadays that supports Java language and has great tools to build and debug Java code.

6. Summary

That was an article describing Java 8 vs Java 10. We saw the major features introduced in both versions. We compared the differences between both versions and understand what we need to install to work with these versions.

Java 8 is an LTS distribution and introduced a functional paradigm to Java language, while Java 10 brought other tools like a REPL console and support for the modular application.

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you our best selling eBooks for FREE!


1. JPA Mini Book

2. JVM Troubleshooting Guide

3. JUnit Tutorial for Unit Testing

4. Java Annotations Tutorial

5. Java Interview Questions

6. Spring Interview Questions

7. Android UI Design


and many more ....


Receive Java & Developer job alerts in your Area


Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments