1.

What is the use of default method in interface?

Answer»

The DEFAULT method implementation was introduced by Java 8 so that the OLD interfaces can use the lambda expression without implementing the methods in the implementation class.

Example

SYNTAX:-

public INTERFACE interview {

        default void print() {

System.out.println("Welcome Bestinterviewquestion.com");

             }

    }



Discussion

No Comment Found