Java 8: why does the functional interface in Java 8 have an abstract method?

As we know in Java 8, new concepts and functional interfaces are introduced The function interface has an abstract method, and several default or static methods are possible

Solution

The function interface, also known as single abstract method interface, is introduced to promote lambda function Since lambda function can only provide the implementation of one method, the function interface must have only one abstract method Refer here for more details

Edit – > it is also worth mentioning that the function interface can have default implementation in the interface You will find more details about the implementation in the link above

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>