Home >Java >Javagetting Started >What are the differences between java 7 and java 8?

What are the differences between java 7 and java 8?

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼Original
2019-11-11 16:20:587118browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:How to run java in cmdNext article:How to run java in cmd