Java 13 & 14 Highlights: Text Blocks, Better NPEs, and Switch Expressions
Java 13 introduced five new features, with Text Blocks gaining the most attention, while the upcoming Java 14 Early‑Access preview highlights three potential enhancements: improved NullPointerExceptions, a new non‑volatile memory mapped byte buffer mode, and the stabilization of Switch Expressions with pattern‑matching syntax.
JDK/Java 13 was released a month ago, bringing five new features, of which Text Blocks has attracted the most discussion.
Text Blocks, similar to Python's triple‑quoted strings, allow multi‑line string literals without most escape sequences, making it easier to embed HTML in Java code and greatly improving readability.
Other Java 13 features are not detailed here; the focus now shifts to the upcoming Java 14.
Java 14 is currently in Early‑Access (EA) and is scheduled for General Availability on March 17 next year. The latest build is 17, with release notes available at the official JDK site.
Improved NullPointerExceptions that precisely indicate which variables are null, providing developers and support staff with useful information about why a program terminated.
Non‑volatile memory (NVM) mapped byte buffers introduce a new JDK‑specific file‑mapping mode, allowing the FileChannel API to create MappedByteBuffer instances that reference NVM, reducing copy and translation costs for transaction‑heavy programs.
Switch Expressions, previewed in JDK 12 and 13, are expected to become a standard feature in Java 14, extending the switch statement to be used as an expression and supporting the concise "case L ->" pattern‑matching syntax.
JDK 14 EA can be downloaded from https://jdk.java.net/13 . Note that features in the EA stage may never appear in the final GA release.
For more information on Java 13, see the following resources:
JDK/Java 13 release announcement
Detailed Java 13 new features
Java 13 new features and practical cases
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Programmer DD
A tinkering programmer and author of "Spring Cloud Microservices in Action"
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
