Oracle announced new enhancements to Java 22 that include 12 new features to the language aimed at making it more accessible to beginners. These include implicitly declared classes, basic instance methods, improved constructor behavior, string templates, and APIs for foreign functions and memory. The new enhancements will be useful in training novice Java developers.


Students will also be able to start writing code without having to learn all the concepts that are inherent in large projects right from the start. This will allow them to learn the language more gradually.

“The new enhancements in Java 22 enable more developers to quickly and easily create applications that are feature-rich, scalable and secure, and that help organizations around the world grow their businesses,” said Georges Saab, senior vice president of Oracle Java Platform and chairman of the OpenJDK board.

The version introduces the use of unnamed variables and templates that are highlighted. These are useful when variable declarations or nested templates are required, although they will not be used. According to Oracle, this new feature will reduce the number of errors, improve the readability of record templates, and increase code maintainability.

Another anticipated feature that has made its way into this release is the API for foreign functions and memory, which allows Java code to interact with code and data outside of the Java Runtime without using the Java Native Interface.

JEP 458 also introduces the ability to allow the Java runtime to run a program that is provided as multiple Java source code files.

Java 22 also includes JEPs in the preview, including APIs for class files and Stream Gatherers, and several in the second preview, such as Structured Concurrency and Scoped Values.

Tags: , , , , , , , , , , , , , , , , , , , , , , ,
Editor @ DevStyleR