0% found this document useful (0 votes)
17 views

Java Lab Programs (49) Functional Interface

Uploaded by

vinol30054
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Java Lab Programs (49) Functional Interface

Uploaded by

vinol30054
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Functional Interface in Java

• Functional Interface in Java is also called Single Abstract Method (SAM) Interface.
• From Java8 onwards, to represent the instance of functional interfaces, lambda
expressions are used. It is a new feature in Java, which helps to achieve functional
programming approach.
• Lambda expressions are anonymous (don’t have names) shortcode blocks that can
take parameters and return a value just like methods.

interface rcat interface rcat


{ {
void javaclass(String stu); void javaclass(String stu);
} }

class abc implements rcat class abc implements rcat


{ {
public void javaclass(String stu) public void javaclass(String stu)
{ {
System.out.println(stu); System.out.println(stu);
} }

public static void main(String a[]) public static void main(String a[])
{ {
abc a1=new abc(); abc a1=new abc();
a1.javaclass("Java SE11"); a1.javaclass("Java SE11");

} rcat r1=new abc();


} r1.javaclass("Oracle Certified");

}
}
@FunctionalInterface @FunctionalInterface
interface rcat interface rcat
{ {
void javaclass(String stu); void javaclass(String stu);
} void javaquiz(String a);
}
class abc implements rcat
{ class abc implements rcat
public void javaclass(String stu) {
{ public void javaclass(String stu)
System.out.println(stu); {
} System.out.println(stu);
}
public static void main(String a[])
{ public static void main(String a[])
abc a1=new abc(); {
a1.javaclass("Java SE11"); abc a1=new abc();
a1.javaclass("Java SE11");
rcat r1=new abc();
r1.javaclass("Oracle Certified"); rcat r1=new abc();
r1.javaclass("Oracle Certified");
}
} }
}

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy