Java 12

Java 12 – Overview

Java 12 introduced lot of new language specific features to Java. This is an introductory tutorial that explains the basic-to-advanced features of Java 12 and their usage in a simple and intuitive way.

This tutorial is designed for Java programmers who would like to understand the Java 12 new features and actual usage.

Prerequisites

Before proceeding with this tutorial, you should have a good understanding of Java programming language.

Java 12 is a major feature release and it has brought many language specific changes to JAVA. It followed the Java release cadence introduced Java 10 onwards and it was released on Mar 2019, just six months after Java 11 release.

Java 12 is a non-LTS release.

New Features

Following are the major new features which are introduced in Java 12.

  1. JVM Changes − JEP 189, JEP 346, JEP 344, and JEP 230.
  2. Switch Expressions − A preview feature allowing switch to use lambda expression.
  3. File.mismatch() method − File Comparison is made easy via mismatch method.
  4. Compact Number Formatting − Numbers can be formatted like 2K, 3M etc easily.
  5. Teeing Collector in Stream API − A merging operator on multiple collectors.
  6. String new methods − four new methods introduced to format a string.
  7. JEP 334 − JVM Constants API introduced.
  8. JEP 305 − A preview feature allowing pattern matching for instanceOf.

Java 12 enhanced numerous APIs with new methods and options. We’ll see these changes in next chapters.

About the Author: Elavarasan PK

Technical Specialist, Intersoft Data Labs