Loading Page Content...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
Preparing courses, live labs, and learning resources.सामग्री लोड हो रही है, कृपया प्रतीक्षा करें...
At the heart of Java's lambda expressions is the concept of a Functional Interface. A functional interface is an interface that contains exactly one abstract method (known as the Single Abstract Method or SAM contract).
Lambdas and method references can be assigned to any variable whose type is a compatible functional interface.
@FunctionalInterface AnnotationThe @FunctionalInterface annotation informs the Java compiler to verify that the annotated interface has exactly one abstract method:
error: Unexpected @FunctionalInterface annotation: interface is not a functional interface
java.lang.Object: Abstract methods that match public methods of java.lang.Object (like equals, hashCode, toString) do not count towards the SAM limit:Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Test your understanding of this lesson with 1 questions. Each question has one correct answer.