Java 8: What is a Functional Interface? - DevDummy

Latest

Coding Hacks, Shared ...

Monday, October 09, 2017

Java 8: What is a Functional Interface?


Functional Interfaces, What is that, seriously, in Java?

Functional Interface is a new concept introduced from Java 8 which are more focused to towards the new features like Lambda Expressions.

What is a Functional Interface?

Functional Interface is an interface which has one and only one abstract method. These interfaces are also called SAM (Single Abstract Method) Interfaces. Java API contain several Functional Interfaces like Comparable, Runnable and etc.

Remarks

Functional Interface can have one and only one abstract method but one or more default methods.

Default Methods ?


In java 8, it is possible to have default methods which contains a default implementation which ensures the consistency of the interface when required.

References


Image Credit : https://pixabay.com/en/hand-button-monitor-finger-touch-2111445

No comments:

Post a Comment