Java 14 New Features
Java SE 14 was released in March 2020. The full list of new features in JDK 14 can be found here: https://openjdk.org/projects/jdk/14/ In this tutorial, we will look over some of these new features and examine some of them. 1. JEP 305: Pattern Matching for instanceof (Preview) With this JEP, instanceof now allows casting of the checked object to a variable. Before Java 14: if (obj instanceof String) { String s = (String) obj; // use s } With Java 14: if (obj instanceof String s) { // can use s here } else { // can't use s here } 2. JEP 345: NUMA-Aware Memory Allocation for G1 This JEP i mproves G1 performance on large machines by implementing NUMA-aware( non-uniform memory access ) memory allocation. Use the +XX:+UseNUMA option to enable it. 3. JEP 358: Helpful NullPointerExceptions This JEP improves the usability of NullPointerException generated by the JVM by describing precisely which variable was null . Let's look over the following code which throw