Home >Java >Javagetting Started >What are the differences between java 7 and java 8?
Compared with java7, the new features of Java8 are as follows:
1. The default method of the interface
Java 8 allows To add a non-abstract method implementation to an interface, you only need to use the default keyword. This feature is also called an extension method.
2. Lambda expression
3. Functional interface
4. Method and constructor references
5. Lambda Scope
The way to access the outer scope in a lambda expression is very similar to that in the old version of anonymous objects. You can directly access outer local variables marked final, or instance fields and static variables.
6. Access local variables
You can directly access outer local variables in lambda expressions.
php Chinese website, a large number of free Java introductory tutorials, welcome to learn online!
The above is the detailed content of What are the differences between java 7 and java 8?. For more information, please follow other related articles on the PHP Chinese website!