In this recipe, you will learn about two new features that were first introduced in Java 8—the default and static methods in an interface.
Creating interfaces with default and static methods
Getting ready
A default method in an interface allows us to add a new method signature without changing the classes that have implemented this interface before a new method signature was added. The method is called default because it provides functionality in case this method is not implemented by the class. If, however, the class implements it, the interface's default implementation is ignored and overridden by the class implementation.
A static method in an interface can provide functionality in the same way a static method...