1 | initial version |
A default method in Java can be specifically invoked by using the interface name followed by the method name. For example, if we have an interface named "MyInterface" with a default method "myMethod", we can invoke the default method as follows:
MyInterface obj = new MyClass();
obj.myMethod(); // Invokes the default method
Here, we have created an object of a class ("MyClass") that implements the "MyInterface". We can then use this object to invoke the default method "myMethod".