Before Java 8, interfaces could have only public abstract methods.
It was not possible to add new functionality to the existing interface without forcing all implementing classes to create an implementation of the new methods, nor it was possible to create interface methods with an implementation.
Starting with Java 8, interfaces can have static and default methods.
The static method can not be overridden in the implementing classes whereas the default method can be overridden in the implementing classes.
Let’s look into the below example for better understanding.
Output