java function interface example
Example 1: interface function
interface SearchFunc {
(source: string, subString: string): boolean;
}
Example 2: how to implement a interface in java
interface methods{
public static hey();
}
class scratch implements methods{
public static hey(){
System.out.println("Hey");
}
}
Example 3: java define interface
interface Animal {
public void eat();
public void travel();
}
Example 4: functional interface java
A functional interface is an interface that contains only one abstract method. They can have only one functionality to exhibit.