In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article will explain in detail what the new features of JDK13 are, and the editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.
1. Optimized update of switch
JDK11 and previous versions:
Switch (day) {case MONDAY: case FRIDAY: case SUNDAY: System.out.println (6); break; case TUESDAY: System.out.println (7); break; case THURSDAY: case SATURDAY: System.out.println (8); break; case WEDNESDAY: System.out.println (9); break;}
JDK12 version
Switch (day) {case MONDAY, FRIDAY, SUNDAY-> System.out.println (6); case TUESDAY-> System.out.println (7); case THURSDAY, SATURDAY-> System.out.println (8); case WEDNESDAY-> System.out.println (9);}
JDK13 version
Static void howMany (int k) {System.out.println (switch (k) {case 1-> "one" case 2-> "two" default-> "many"});} 2, text block upgrade
2.1.Example of html
Before JDK13
String html = "\ n" + "\ n" + "
Hello, world
\ n "+"\ n "+"\ n
JDK13 optimized:
String html = ""
Hello, world
""
2.2.2.The change of SQL
Before JDK13
String query = "SELECT `NAME` FROM `EMPLOYEE_ TB`\ n" + "WHERE `CITY` = 'INDIANAPOLIS'\ n" + "ORDER BY `EMP_ ID`, `LAST_ NAME`;\ n"
JDK13
String query = "" SELECT `NAME` FROM `EMPLOYEE_ TB`WHERE `CITY` = 'INDIANAPOLIS' ORDER BY `EMP_ ID`, `LAST_ NAME`; ""
2.3. Explanation
Text block
"" line 1line 2line 3 ""
Equivalent to string text:
"line 1\ nline 2\ nline 3\ n" 3. Dynamic CDS files
Goal:
Improve the availability of application classes-data sharing (AppCDS). Eliminates the need for users to make a trial run to create a list of classes for each application. -Xshare:dump use class list static archiving enabled by this option should continue to work. This includes classes for built-in class loaders and user-defined class loaders. 4. cancel the use of unused memory
Summary:
Enhance ZGC to return unused heap memory to the operating system.
Motivation:
ZGC is not currently uncommitting and returning memory to the operating system, even if it has not been used for a long time. This behavior is not optimal for all types of applications and environments, especially those that need to focus on memory footprint, such as container environments through the use of payment resources. An environment in which an application may be idle for a long time and share or compete for resources with many other applications. Applications may have very different heap space requirements during execution. For example, the heap required during startup may be larger than that required later during steady-state execution. Other garbage collectors in HotSpot, such as G1 and Shenandoah, provide this functionality today, and some categories of users find it very useful. Adding this feature to ZGC will be welcomed by the same group of users. 5. Re-implement the old socket API
Summary:
Use simpler, more modern implementations to replace the underlying implementations used by java.net.Socket and java.net.ServerSocketAPI, making it easy to maintain and debug. The new implementation can easily adapt to user-mode threads, that is, optical fiber, which is currently being explored in Project Loom.
Motivation:
Java.net.Socket and java.net.ServerSocketAPI, as well as their underlying implementations, can be traced back to JDK 1.0. The implementation is a mixture of legacy Java and C code, and maintenance and debugging are painful. This implementation uses the thread stack as the Ithumb O buffer, which requires increasing the default thread stack size multiple times. The implementation uses native data structures to support asynchronous shutdown, which is at the root of subtle reliability and migration problems over the years. There are several concurrency problems in this implementation, which need to be overhauled before they can be solved correctly. In the future optical world environment, rather than blocking threads in native methods, the current implementation is not suitable for the purpose. Add Q group: 478052716 free (Java framework materials, video materials, BATJ interview materials) 6, FileSystems.newFileSystem new method
The FileSystems.newFileSystem (Path,Map) method is added to the core library / java.nio
Three new methods, java.nio.file.FileSystems, have been added to make it easier to use file system providers that treat file contents as file systems.
1. NewFileSystem (Path) 2, newFileSystem (Path, Map) 3, newFileSystem (Path, Map, ClassLoader) added as newFileSystem (Path, Map) has used the existing 2-arg newFileSystem (Path, ClassLoader) and specified the code of the class loader to create source (but not binary) compatibility issues. Null. For example, because the reference newFileSystem is ambiguous, the following cannot be compiled: FileSystem fs = FileSystems.newFileSystem (path, null); to avoid obscure references, you need to modify this code to cast the second parameter to java.lang.ClassLoader. 7. New method of nio
The new java.nio.ByteBuffer batch get / place method in the core library / java.nio transfers bytes regardless of buffer location.
Java.nio.ByteBufferjava.nio other buffer types now define methods for transmitting consecutive byte sequences in absolute batches of get and put, regardless of or affecting buffer locations. 8. Core library / java.time New Japan era name Reiwa, an example representing the new Reiwa era has been added in this update. Unlike other times, there is no public domain in this era. It can either call JapaneseEra.of (3) or get JapaneseEra.valueOf ("Reiwa"). JDK13 and later will have a new public domain to represent this era. The Japanese-era placeholder name "" of NewEra, which began on May 1, 2019, has been replaced by a new official name. Applications that rely on placeholder names (see JDK-8202088) to get new-age singletons (JapaneseEra.valueOf ("NewEra")) will no longer work. See JDK-82054329, Core Library / java.util: i18N
Support for Unicode 12.1, which upgrades Unicode support to 12.1, including the following:
Java.lang.Character supports a level 12.1 Unicode character database, of which 12.0 adds 554 characters from 11.0, for a total of 137928 characters. These additions include 4 new scripts, a total of 150 scripts, and 61 new emoji characters. U+32FF SQUARE ERA NAME REIWA starts at 12.0,12.1 adds only one character. The java.text.Bidi and java.text.Normalizer classes support Unicode standard attachments at level 12.0, # 9 and # 15, respectively. Java.util.regexpackage supports extended glyph clusters based on attachment # 29 of the level 12.0 Unicode standard. 10. Hot spot / GC 10.1 JEP 351 ZGC uncommit unused memory 10.2 added-XXSoftMaxHeapSize flag 10.3 the maximum heap size supported by ZGC increased from 4TB to 16TB11, security library / java.security 11.1 the com.sun.security.crl.readtimeout system property is set to the maximum read timeout for CRL retrieval, in seconds. If the property has not been set, or if its value is negative, set it to the default value of 15 seconds. A value of 0 indicates an infinite timeout. 11.2 New keytool-showinfo-tls commands for displaying TLS configuration information keytool-showinfo-tls added a new command to display TLS configuration information. The SunMSCAPI provider now supports reading private keys in the next generation encryption (CNG) format. This means that RSA and EC keys in CNG format can be loaded from the Windows KeyStore, such as "Windows-MY". And EC (signature algorithm SHA1withECDSA,SHA256withECDSA, etc.) are also supported. 12. Delete function
Some of the features deleted:
Pre-JDK 1.4 SocketImpl implementation java.net.SocketImpl is no longer supported in the core library / java.net. This version has removed support for custom implementations compiled for JavaSE1.3 and earlier versions. This change has no impact on implementations that SocketImpl compiled for Java SE 1.4 (released in 2002) or later. In the core library / java.lang, delete the runtime trace method, the outdated method traceInstructions (boolean), and traceMethodCalls (boolean) have removed the java.lang.Runtime class from. These methods do not work for many versions, and their expected functionality is provided by the Java Virtual Machine tool Interface (JVMTI). This is the end of the article on "what are the new features of JDK13". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.