Oracle has released Java 22, with short-term support for 6 months (Java 21 had long-term support for 2 years). A key feature of Java 22 is Unnamed Variables & Patterns, allowing you to name variables that are required but not used with an underscore (_) symbol instead of any specific name. For example, the variable “order” in the code sample is not actually used but must be declared (and might be scolded by the compiler for having an unused variable). In the Java 22 specification, you can now use the underscore (_) to explicitly indicate a variable that does not need to be named.
Other new features include Foreign Function & Memory API for connecting with functions in languages other than Java Runtime, launching multi-file source code programs without compiling them first, and regional pinning for G1 garbage collector to set working areas in memory when working with C/C++ code to avoid shutting down G1 every time.
Oracle also allows the usage of Oracle GraalVM for JDK 22 for free, just like they did when it all began with Java 20.
TLDR: Java 22 introduces Unnamed Variables & Patterns, Foreign Function & Memory API, Launch Multi-File Source-Code Programs, and Regional Pinning for G1 garbage collector. Oracle continues to provide GraalVM for JDK 22 for free.
Leave a Comment