Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the new features of JDK15

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces "what are the new functions of JDK15". In daily operation, I believe many people have doubts about the new functions of JDK15. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for you to answer the doubts about "what are the new functions of JDK15?" Next, please follow the editor to study!

1. EdDSA digital signature algorithm.

Add Edwards-Curve digital signature algorithm (EdDSA) to realize encrypted signature. It is supported in many other encryption libraries, such as OpenSSL and BoringSSL. Compared with the existing signature schemes in JDK, EdDSA has higher security and performance. This is a new feature.

2. Hide the class

This feature helps frameworks that need to generate classes at run time. Framework-generated classes need to dynamically extend their behavior, but want to restrict access to those classes. Hidden classes are useful because they can only be accessed through reflection, not from normal bytecode. In addition, hidden classes can be loaded independently of other classes, which reduces the memory footprint of the framework. This is a new feature.

3. Re-implement DatagramSocket API

Re-implement the old version of DatagramSocket API, simpler and more modern implementation to replace the basic implementation of java.net.DatagramSocket and java.net.MulticastSocketAPI, and improve the maintainability and stability of JDK.

4. ZGC function becomes a regular employee.

ZGC has been integrated into JDK 11 by JEP 333, and the goal is to improve performance by reducing GC pause times. With the help of JEP 377 Magazine ZGC, it has changed from preview function to production function.

5. The function of text block becomes a regular one.

Introduced by JEP 355 in 2019, a text block is a multiline string text that avoids the need for most escape sequences, automatically formats strings in a predictable way, and enables developers to control formatting when needed. With JEP 378, text blocks have become a permanent feature of the Java language.

6. Shenandoah garbage collection algorithm becomes a regular one.

Shenandoah garbage collection has changed from experimental characteristic to product characteristic. This is a recycling algorithm introduced from JDK 12 that reduces GC pause time by evacuating at the same time as a running Java thread. The pause time of the Shenandoah is independent of the heap size, and has the same consistent pause time regardless of whether the stack is 200 MB or 200 GB.

7. Sealing class (preview)

Enhance the Java programming language with sealed classes and interfaces to limit the use of superclasses, and sealed classes and interfaces restrict other classes or interfaces that may inherit or implement them.

8. Instanceof automatic matching mode (preview)

Old way of writing:

/ / determine the type if (obj instanceof String) {/ / and then convert String s = (String) obj; / / before you can use}

The new way of writing:

If (obj instanceof String s) {/ / use} else directly if type matching {/ / cannot be used directly if type mismatch

This is the second preview of this feature, and we have previewed the feature for the first time in Java 14.

9. Records Class (Preview)

Records Class is also a preview feature for the second time. It also appeared once in JDK 14. Using Record makes it easier to create a constant class. The code before and after the use is as follows.

Old way of writing:

Class Point {private final int x; private final int y; Point (int x, int y) {this.x = x; this.y = y;} int x () {return x;} int y () {return y;} public boolean equals (Object o) {if (! (o instanceof Point)) return false; Point other = (Point) o Return other.x = = x & & other.y = y;} public int hashCode () {return Objects.hash (x, y);} public String toString () {return String.format ("Point [x% d, y% d]", x, y);}}

The new way of writing:

Record Point (int x, int y) {}

That is, after using record, you can write a constant class in one line of code, and the constant class also contains constructors, toString (), equals (), and hashCode () methods.

10. External memory access API (preview)

The goal is to introduce an API to allow Java programs to safely and efficiently access external memory outside the Java heap. This is also a preview feature of Java 14.

11. Other functions

Other features include deprecated and deprecated features, such as removing the Nashorn JavaScript engine, removing Solaris and SPARC ports, and marking some deprecated features.

At this point, the study on "what are the new functions of JDK15" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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.

Share To

Development

  • What are the two ways of mapper interface injection?

    Many novices are not very clear about what the two ways of mapper interface injection are. In order to help you solve this problem, the following editor will explain it in detail. People with this need can come and learn. I hope you can get something. 1. How to use templates:

    © 2024 shulou.com SLNews company. All rights reserved.

    12
    Report