Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

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

1. https://www.oreilly.com/learning/whats-new-in-java-8-lambdas
2. http://www.oracle.com/technetwork/java/javase/8-whats-new-2157071.html

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


This post first appeared on Devdummy, please read the originial post: here

Share the post

Java 8: What is a Functional Interface?

×

Subscribe to Devdummy

Get updates delivered right to your inbox!

Thank you for your subscription

×