Functional Interface in Java 8 or Above

Dr. Vipin Kumar
1 min readJan 25, 2021

Functional Interface

Functional Interface is new concepts in Java after version 1.8, It is the core striking features in version 1.8, because of a functional interface, other features of java 1.8 exists like Lambda expression, method references, Java.util.function packages and Java Stream API. All these features are 100% dependent on functional interface. This functional interface concept brings again Java to stand strongly in front of the functional programming supported languages like Python, Ruby, etc.

It is not a new kind of interface; it is an old one but with some restrictions. An Interface, which allows only one abstract method declaration with @FunctionalInterface annotation is called Functional Interface. In Function Interfaces, more than one default, or static method is allowing and you can also write java.lang.Object class methods, but more than one abstract method is not allowed.

Let’s understand it by example:

@FunctionalInterface

interface Message {

public abstract void msg ();

}

public class Main implements Message {

public void msg ()

{

System.out.println(“This is Functional Interface Method”);

}

public static void main (String args )

{

Message m1 = new Main ();

m1.msg();

}

}

Advantages of Functions Interfaces:

1. To develop function programming in Java

2. To develop lambda expression in Java

3. To develop method references in Java

For more information your can watch this video:

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Dr. Vipin Kumar
Dr. Vipin Kumar

Written by Dr. Vipin Kumar

Assoc. Prof. , DCA & Assoc. Head (SD), SDFS, at KIET, PhD (CS) My YouTube Channel: Dr. Vipin Classes (https://www.youtube.com/channel/UC-77P2ONqHrW7h5r6MAqgSQ)

No responses yet

Write a response