Why Functional Interfaces in Java 8 have one Abstract Method?

Harmeet Singh Taara picture Harmeet Singh Taara · Apr 28, 2014 · Viewed 17.9k times · Source

As we know in Java 8, the concept of functional interfaces are introduced. A Functional Interface has one abstract method and several default or static methods are possible.

But why should a Functional interface have only one abstract method? If Interface has more then one abstract method, why is this not a Functional Interface?

Answer

AdityaKeyal picture AdityaKeyal · Apr 28, 2014

The functional interface also known as Single Abstract Method Interface was introduced to facilitate Lambda functions. Since a lambda function can only provide the implementation for 1 method it is mandatory for the functional interface to have ONLY one abstract method. For more details refer here.

Edit -> Also worth noting here is that, a functional interface can have a default implementation in the interface. You will find a lot more details on the implementation on the link above.