Posts
Showing posts from 2023
Functional Interface
- Get link
- X
- Other Apps
By
Chief
on
Definition - A functional interface is an interface that contains strictly only one abstract method but may or may not contain one or more default methods or static methods. Below are examples of the valid functional interface definition. With abstract method only With all allowed methods Working code snippet Below are examples of the invalid functional interface definition. With no methods With multiple abstract methods Points to remember here are as below, @FunctionalInterface annotation is optional. Abstract method can only be public or package-private. Static method allows all access modifiers except protected. Default method allows only public and package-private.