In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "what are the new features of Java15". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what are the new features of Java15.
New features
List of new features in JDK 15:
IDJEPFeature1339Edwards-Curve Digital Signature Algorithm (EdDSA) 2360Sealed Classes (Preview) 3371Hidden Classes4372Remove the Nashorn JavaScript Engine5373Reimplement the Legacy DatagramSocket API6374Disable and Deprecate Biased Locking7375Pattern Matching for instanceof (Second Preview) 8377ZGC: a Scalable Low-Latency Garbage Collector9378Text Blocks10379Shenandoah: a Low-Pause-Time Garbage Collector11381Remove the Solaris and SPARC Ports12383Foreign-Memory Access API (Second Incubator) 13384Records (Second Preview) 14385Deprecate RMI Activation for Removal
339:Edwards-Curve Digital Signature Algorithm (EdDSA)
Edwards-Curve data signature algorithm (EdDSA), an Edwards-Curve digital signature algorithm (EdDSA) described by RFC 8032 specification, implements a RFC 8032 standardization scheme, but it can not replace ECDSA.
EdDSA is a modern elliptic curve signature scheme, which has many advantages compared with the existing signature schemes in JDK.
360:Sealed Classes (Preview)
Closed classes (preview features), which can be closed classes and or closed interfaces, are used to enhance the Java programming language and prevent other classes or interfaces from extending or implementing them.
This is amazing, ah, with this feature, it means that you don't inherit it if you want to inherit it, but you have to get permission to realize it.
Take a look at this example:
Public abstract sealed class Student permits ZhangSan, LiSi, ZhaoLiu {...}
The class Student is modified by sealed to indicate that it is a closed class and only three specified subclasses are allowed to inherit.
371:Hidden Classes
Hidden classes, which is also an interesting feature.
Hidden classes are designed for the frameworks. Hidden classes cannot be directly used by the bytecode of other classes, but can only be generated at run time and used indirectly through reflection.
372:Remove the Nashorn JavaScript Engine
Remove the Nashorn JavaScript scripting engine, APIs, and jjs tools. These have already been marked as deprecated in JDK 11, and it is normal for JDK 15 to be removed.
Nashorn is a JavaScript scripting engine introduced by JDK 1.8 to replace Rhino scripting engine. Nashorn is a complete implementation of ECMAScript-262 5.1, which enhances the compatibility between Java and JavaScript and greatly improves performance.
Why remove it?
The official description is that with the structure of the ECMAScript scripting language and the faster and faster adaptation of API, maintaining Nashorn is too challenging, so.
373:Reimplement the Legacy DatagramSocket API
The old DatagramSocket API interface has been reimplemented, and java.net.DatagramSocket and java.net.MulticastSocket have been changed to a simpler, modern underlying implementation that is easier to maintain and debug.
The new underlying implementation will be easy to use virtual threads and is currently being explored in the Loom project. This is also a follow-on update to JEP 353, which has re-implemented Socket API.
374:Disable and Deprecate Biased Locking
Prepare to disable and abolish biased locks. In JDK 15, biased locks are disabled by default, and all relevant command line options are discarded.
It will be determined later whether it is necessary to continue to support biased locks, and the cost of optimizing the synchronization of such locks is too high.
375:Pattern Matching for instanceof (Second Preview)
Pattern matching (second preview), the first preview is proposed in JDK 14, click here to view the detailed tutorial written before the stack length.
Before Java 14:
If (object instanceof Kid) {Kid kid = (Kid) object; / /...} else if (object instanceof Kiddle) {Kid kid = (Kid) object; / /...}
Java 14C:
If (object instanceof Kid kid) {/ /...} else if (object instanceof Kiddle kiddle) {/ /...}
Java 15 does not adjust this feature and continues to preview the feature, just to collect more user feedback, which may not be mature.
377:ZGC: A Scalable Low-Latency Garbage Collector
ZGC: a scalable, low-latency garbage collector.
ZGC was first integrated in JDK 11, and JDK 15 just changed the ZGC garbage collector from a preview feature to a formal feature, yes, a regular one.
This JEP will not change the default GC, which is still G1.
378:Text Blocks
A text block, a multiline string, avoids the use of most escape symbols, automatically formats strings in a predictable manner, and allows developers to control formatting when needed.
The text block was originally added in JDK 12, but eventually undone, then added as a preview feature in JDK 13, and then previewed again in JDK 14, where the text block finally became regular in JDK 15 without further changes.
Take a look at this example and you'll see:
Before Java 13:
String html = "\ n" + "\ n" + "
Hi, Java technology stack
\ n "+"
Welcome to follow us and share more practical information.
\ n "+"\ n "+"\ n
Java 13C:
String html = ""
Hi, Java technology stack
Welcome to follow us and share more practical information.
""
It's too cool to get rid of those useless line breaks and stitches. Another article of this detailed tutorial is planned to follow the push of the official account Java technology stack as soon as possible.
379:Shenandoah: A Low-Pause-Time Garbage Collector
Shenandoah: a garbage collector with low pause time.
Shenandoah was first integrated in JDK 12, and JDK 15 just changed the Shenandoah garbage collector from a preview feature to a formal feature, and yes, it became a regular feature again.
381:Remove the Solaris and SPARC Ports
Remove the Solaris and SPARC ports.
Remove source code and build support for Solaris/SPARC, Solaris/x64, and Linux/SPARC ports. These ports have been marked as deprecated in JDK 14, and it is not surprising that JDK 15 has been removed.
383:Foreign-Memory Access API (Second Incubator)
Out-of-memory access to API (secondary incubation) allows Java applications to safely and effectively access external memory outside the Java heap.
This first became a hatching feature in JDK 14, and JDK 15 continued to re-hatch and made some updates to its API.
384:Records (Second Preview)
Records first became a preview feature in JDK 14, and JDK 15 continues the second preview.
In some cases, Records can kill the existence of Lombok and automatically generate class constructors, toString (), hashCode (), equals (), and variable access methods like getter.
Mode of use:
Public record Student (String name, int id, int age) {}
385:Deprecate RMI Activation for Removal
Abolish the RMI activation so that it can be deleted in the future.
It is important to note that RMI activation is an outdated component of RMI and has been optional since Java 8.
At this point, I believe you have a deeper understanding of "what are the new features of Java15". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.