10 new features in Java 10 that will revolutionize the way you write code! Java 9 has only been out for a few months and a lot of things are still missing, but now Java 10 is coming.
JDK 8 is not yet ready. JDK 9 has just been released. JDK 10 is not yet ready.
Can not small partners from 0, learn to install, video demonstration oh ~
Installation demo: edu.csdn.net/course/deta…
Java learning Resources: edu.csdn.net/lecturer/80…
More tutorials to share: edu.csdn.net/courses?utm…
Does the student who just learned Java feel a face to be forced? !!!!!!!!!
Even I, an old driver, felt the same way!
Java updates faster and faster, we do technology to keep up with the pace, or there will always be a slow others, this new things from abroad to domestic application generally take a few years, if we understand and apply these new technologies in advance is not bad for their own.
New features in Java 10
Having said that, what features will Java 10 have that will change the way we write code? !
Local variable type inference
Local variable type inference is arguably the most notable feature in Java 10, and it is another step taken by Java language developers to simplify the writing of Java applications, as shown in the figure below.
10 new features in Java 10 that will revolutionize the way you write code! This new feature will add some syntactic sugar to Java – simplifying it and improving the developer experience. The new syntax will reduce the verbosity associated with writing Java, while maintaining the promise of static type safety.
Local variable type inference will introduce the “var” keyword, which means that you can define variables without specifying their type, for example:
List List = new ArrayList (); Stream Stream = getStream (); Will be replaced by this new syntax:
Var list = new ArrayList (); Var stream = getStream (); After seeing is a bit JS namely inspect feeling?? More and more like JS? ! While type inference is not a new concept in Java, it is a big improvement in local variables.
When it comes to type inference, Java type inference has taken a big step forward, from the introduction of generics in JDK 5, to the “<>” operator in JDK 7 that allows List initialization without binding types, to Lambda expressions in JDK 8, and now local variable type inference in JDK 10.
// This operator allows initializing the List without binding the type ArrayList <>. List List = new LinkedList <> (); Local variable types are recommended only for the following scenarios:
A local variable initializes an internal index variable for a traditional for loop declaration variable Java official states that it cannot be used in any of the following places:
Method parameter constructor Parameter method returns a type field capture expression (or any other type of variable declaration)
2.GC improvements and memory management
There are two Jeps in JDK 10 dedicated to improving the current garbage collection elements.
The first garbage collector interface is (JEP 304), which will introduce a clean garbage collector interface to help improve source isolation of different garbage collectors.
The second JEP slated for Java 10 is the parallel full GC for G1 (JEP 307), which focuses on improving G1 worst-case wait times through full GC parallelism. G1 is the default GC in Java 9, and the goal of this JEP is to make G1 parallel.
3. Thread-local handshake (JEP 312)
JDK 10 will introduce a new way to perform callbacks on threads, so it will be handy to stop a single thread rather than all or none at all.
4. Heap allocation on standby memory devices (JEP 316)
Allows HotSpot VM to allocate Java object heap memory on an alternate memory device, which will be specified by the user.
5. Other Unicode Languages – Markup Extensions (JEP 314)
The goal is to enhance java.util.locale and its associated apis to enable other Unicode extensions to the language markup syntax (BCP 47).
6. Experimental Java-based JIT compiler
Oracle wants Graal, its Java JIT compiler, to be used as an experimental JIT compiler on the Linux/X64 platform.
7. Root Certificate (JEP 319)
The goal is to open source the root certificate in Oracle’s Java SE.
8. Root Certificate Issuing Certification (CA)
This will make OpenJDK more attractive to developers, and it also aims to reduce the differences between OpenJDK and Oracle JDK builds.
9. Ecological integration of the JDK into a single repository (JEP 296)
The main goal of this JEP is to perform some memory management and combine the many repositories in the JDK ecosystem into one repository.
10. Delete tool Javah (JEP 313)
Removing the Javah tool from the JDK is simple and important.
Java 10 early adopters
As with all other JDK releases, Oracle has released a Java 10 Initial release candidate that Java developers can download to test new features. If you’re excited about Java 10 and want to try it out early, get started now!
Early adopters address: openjdk.java.net/projects/jd…
One last thought
While the first feature is a big step forward, all the other features are more or less good news for developers. But it remains to be seen what Java 10 will eventually look like, perhaps with more practical new features or optimizations.
All you need to do now is familiarize yourself with JDK 8, which is now standard for many Internet companies. If you are still using JDK4-7, you are OUT.
Java learning Resources: edu.csdn.net/lecturer/80…
More tutorials to share: edu.csdn.net/courses?utm…
Java 10 will revolutionize the way you write code in the near future!
I hope this article will be helpful.