What’s new in Java 10? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 11

What’s new in Java 10?

Is here a lessons about java 10? Who knows or try?

6th Sep 2018, 4:25 PM
Vadim Yangunaev
Vadim Yangunaev - avatar
7 Answers
+ 4
The two big stories in Java 10 are: the new var keyword, just like you’d imagine with any new language construct, and the new six-month release cycle Also, developers will be excited to see more API evolution. And, there are runtime improvements, new performance tuning knobs, and the now-perennial garbage collection improvements that we’ve come to expect with each release. But there are a number of other interesting things, too, especially if you know how to read in between the lines and look ahead to Java 11 in September. Local Variable Type Inference With the exception of assert from the Java 1.4 days, new keywords always seem to make a big splash, and var is no different. Perhaps, the most curious thing about it is that it isn’t actually a reserved word, but something else entirely. But, there will be more on that in a moment. What the var keyword does is turn local variable assignments... HashMap<String, String> ughThisIsSoVerbose = new HashMap<>(); into: var succinct = new HashMap<String, String>(); Added Readability Simply put, as long as the construct on the right-hand side doesn’t require a target type on the left-hand side (like lambdas do), then, you can make all kinds of code easier to read, as shown below: var tshirts = Lists.of("Baeldung Medium", "Java Large", "Lua Small"); var lines = Files.get(Paths.get("log/catalina.out")); var length = lines.count(); Some Caveats In other words, Java 10 introduces local-variable type inference to the language. At compile time, it figures out the reference type based on the value type. Now, we can append this to the growing list of type inferences that Java makes, already including type inference with generics and with lambda expressions. This feature has been a long time coming. It was suggested as far back as 2001 and was closed at that time with the following comment by Gilad Bracha. Humans benefit from the redundancy of the type declaration in two ways. First, the redundant type serves as valuable docume
7th Sep 2018, 8:31 AM
kiran sahu
kiran sahu - avatar
+ 3
Tind I would love so much to develop the Java programming language or a completely new one. ps: var is in/derivated_from Python too/maybe. 😊
6th Sep 2018, 6:37 PM
Angelo Sorte
Angelo Sorte - avatar
+ 2
Key improvements include local variable types as well as enhancements for garbage collection and compilation. JDK 10 is scheduled to be just a short-term release, and public updates for JDK 10 are stated to end in six months. The upcoming JDK 11, due in September, will be a long-term support (LTS) version of Java. LTS releases are due every three years.
7th Sep 2018, 6:34 PM
Raktim Ranjan Deka
Raktim Ranjan Deka - avatar
+ 1
Some people just learn differently. You need to find the way you like to learn and learn that way. Have fun coding 👍
7th Sep 2018, 4:47 AM
Kevin David
Kevin David - avatar
0
ty both answers
7th Sep 2018, 9:42 AM
Цогоо
Цогоо - avatar
0
the sololern find
7th Sep 2018, 12:55 PM
‎يحيى قاسم
‎يحيى قاسم - avatar
0
type inference
21st Sep 2018, 11:55 AM
Keahav Keyal
Keahav Keyal - avatar