Why Functional Interfaces in Java 8 have one Abstract Method? -


As we know in Java 8, the concept of functional interfaces is introduced. A functional interface has a abstract method and many default or static methods are possible.

But why should a functional interface only have an abstract method? If there is an abstract method in the interface, then why is not it a functional interface?

functional interface which is also known as single abstract method Lambda functions were introduced to provide the facility since the Lambda function can only provide the implementation of 1 method, therefore it is compulsory for a single abstract method for functional interfaces. for more information.

Edit -> It is also worth noting that a functional interface can have a default implementation in the interface. You will find more details about the implementation on the above link.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -