1 min to read
What's new in Java 10
Java 10 new features and enhancements
JDK 10 is out since March 20, 2018. Notably for developers, local variable type inference (var reserved word) introduced and now you would write some codes like this in Java. Much similar to Java Script!
public class Main {
public static void main(String[] args) {
var countries = Set.of("Singapore","Sri Lanka", "France", "India");//Java 9 Factory for Immutable Set
countries.forEach(Main::printFirstChar);//New in Java 8
}
public static void printFirstChar(String s) {
System.out.println(s.charAt(0));
}
}
https://github.com/idotrick/practice-java/blob/f4ce11d1745241020db613c88d93282373e4b7a6/src/main/java/algorithm/ReverseWordsInSentense.java#L1
Comments