This article is a continuation of Introduction to the New Generation Java Programming Guide (Java 11).
Java 12 describes two things:
Switch statements are not a formal feature of Java 12.
On the contrary, Java 13 is not official and is a formal feature from Java 14.
The book explains that you should specify the --enable-preview
option at compile time or run time as a way to use the preview function, but Java 14 has also been released now, so if you use Java 14, there is no option. You can do it.
To be honest, I haven't used switch so much until now, but I think that using this switch expression will increase the number of cases where you can write completely safe code.
The book explains in an easy-to-understand manner what was the problem with the switch so far and how it was improved with the switch expression, along with sample code.
Other improvements are described in the following items.
As with all the examples, only a brief explanation is given, but in such a situation, the "default CDS archive" is a little more explanation. Moreover, even though CDS is explained in detail in Java 10 "AppCDS Application Class Data Sharing". Perhaps this is because the author wants you to use this feature. I don't know what I mean, but I felt that way. I also felt that the GC was constantly being improved.
This is the introduction of the new generation Java programming guide (Java 12).
Recommended Posts