What is new in Java 12

Java 12 reached General Availability on 19 March 2019, download Java 12 here or this openJDK archived. Java 12 features. 1. JEP 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental) 2. JEP 230: Microbenchmark Suite 3. JEP 325: Switch Expressions (Preview) 4. JEP 334: JVM Constants API 5. JEP 340: One AArch64 Port, Not Two 6. …

Read more

Java – How to enable the preview language features?

This article shows you how to use –enable-preview to enable the preview language features in Java 12, 13 and above. Note Read this JEP 12: Preview Language and VM Features P.S All preview features are disabled by default. On JDK 12: # compile javac Example.java // Do not enable any preview features javac –release 12 …

Read more

Java 12 – Switch Expressions

Java 12, JEP 325: Switch Expressions enhanced the traditional switch statement to support the following new features: Multiple case labels Switch expression returning value via break (replaced with yield in Java 13 switch expressions) Switch expression returning value via label rules (arrow) P.S Switch expressions are a preview feature and are disabled by default. A …

Read more

java.lang.UnsupportedClassVersionError

Start a Java class and hits this java.lang.UnsupportedClassVersionError, what is class file version 52 56? Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.UnsupportedClassVersionError: TestHello has been compiled by a more recent version of the Java Runtime (class file version 56.0), this version of the Java …

Read more