JDK 15: The New Features in Java 15

JDK 15: The New Features in Java 15

New Java 15 Features: Sealed Classes; Pattern Matching for instanceof; Records; Text Blocks; Hidden Classes; Remove the Nashorn JavaScript Engine; Reimplement the Legacy DatagramSocket API; Disable and Deprecate Biased Locking; Shenandoah: A Low-Pause-Time Garbage Collector; Remove the Solaris and SPARC Ports; Foreign-Memory Access API (Second Incubator); Deprecate RMI Activation for Removal

Local records and Sealed classes find their way in Java 15

Keeping up with the six-month cycle tradition, after the release of Java 14 on March 17, 2020, we now have Java 15, the next non-LTS version rolling out on September 15, 2020.

Here’s a quick look at features that are a part of Java 15:

  • Sealed Classes (Preview) — JEP 360
  • Pattern Matching for instanceof (Second Preview) — JEP 375
  • Records (Second Preview) — JEP 359
  • Text Blocks (Standard) — JEP 378
  • Hidden Classes — JEP 371
  • Remove the Nashorn JavaScript Engine — JEP 372
  • Reimplement the Legacy DatagramSocket API — JEP 373
  • Disable and Deprecate Biased Locking — JEP 374
  • Shenandoah: A Low-Pause-Time Garbage Collector — JEP 379
  • Remove the Solaris and SPARC Ports — JEP 381
  • Foreign-Memory Access API (Second Incubator) — JEP 383
  • Deprecate RMI Activation for Removal — JEP 385

Java 15 Installation Setup on Mac OS

  • To get started with Java 15, download the JDK from here.
  • Copy and extract the tar file in the /Library/Java/JavaVirtualMachines as shown below:
$ cd /Library/Java/JavaVirtualMachines 
$ sudo cp ~/Downloads/openjdk-15_osx-x64_bin.tar.gz /Library/Java/JavaVirtualMachines

$ sudo tar xzf openjdk-15_osx-x64_bin.tar.gz 
$ sudo rm openjdk-15_osx-x64_bin.tar.gz

Once that’s done, open the bash_profile using any text editor. I'm using vim ~/.bash_profile. Set the path of Java15 to JAVA_HOME, save changes and do a source ~/.bash_profile to reflect the changes.

export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-15.jdk/Contents/Home

Finally, you’re ready to compile and run programs using Java 15. We’ll be using JShell, an interactive REPL command-line tool for quickly testing the new Java 15 features.

It’s important to note that many features released in Java 15 are in preview. This means that though they’re fully working right now, things may be modified in the future. Some could be made a standard or simply removed in the next release cycles. In order to test preview features, you need to explicitly set --enable-preview when running the JShell or Java Program as shown below:

jshell --enable-preview javac --release 15 --enable-preview Author.java

In the next few sections, let’s discuss the significant language changes in Java 15.

java programming developer

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK? OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE).

Top 10+ Java Development Companies in India & Developers Reviews 2020 – TopDevelopers.co

A thoroughly researched list of top 10 Java development companies in India with ratings & reviews to help find the best java developers around India.

How long does it take to develop/build an app?

This article covers A-Z about the mobile and web app development process and answers your question on how long does it take to develop/build an app.

Developer Career Path: To Become a Team Lead or Stay a Developer?

For a developer, becoming a team leader can be a trap or open up opportunities for creating software. Two years ago, when I was a developer, ... by Oleg Sklyarov, Fullstack Developer at Skyeng company

Reasons Why Dot NET is Better Than Java

Reasons Why Dot NET is Better Than Java. Java is used a lot for application development but .net's popularity is increasing day by day.Read more about .net Vs Java, which is better?