An interface which includes an abstract method, default method , static method and can also override Object class methods.
public interface FunctionalInterface {
// Only abstract method.
void abc(Collection collection);
// Functional interface can have more than one static or default methods.
default void print() {
System.out.println("This is default in Functional Interface.");
}
//An interface can also have static helper methods from Java 8 onwards.
static void abc() {
System.out.println("Hey");
}
// And also can override methods of java.lang.Object
@Override
public String toString();
}
No comments:
Post a Comment