Home >Java >Javagetting Started >What are the new features of java8
The new features of java8 are: 1. Lambda expression; 2. Method reference; 3. Default method; 4. New compilation tool; 5. Stream API; 6. Date Time API; 7. Option; 8. Nashorn javascript engine.
Java8 has added a lot of new features, we mainly discuss the following:
(Learning video recommendation: java course )
1. Lambda expression
Lambda allows a function to be used as a parameter of a method (the function is passed into the method as a parameter).
2. Method reference
Method reference provides a very useful syntax that can directly reference methods or constructors of existing Java classes or objects (instances). Used in conjunction with lambda, method references can make the language structure more compact and concise and reduce redundant code.
3. Default method
The default method is a method that has an implementation in the interface.
4. New tools
New compilation tools, such as: Nashorn engine jjs, class dependency analyzer jdeps.
5. Stream API
The newly added Stream API (java.util.stream) introduces the true functional programming style into Java.
6. Date Time API
Strengthen the processing of date and time.
7. Optional class
The Optional class has become part of the Java 8 class library and is used to solve null pointer exceptions.
8. Nashorn JavaScript engine
Java 8 provides a new Nashorn javascript engine, which allows us to run specific javascript applications on the JVM.
Related recommendations:Getting started with java
The above is the detailed content of What are the new features of java8. For more information, please follow other related articles on the PHP Chinese website!