O'Reilly logo

Java 9 Cookbook by Nick Samoylov, Mohamed Sanaulla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Getting ready

The default method allows you to add new functionality to an interface without changing the classes that have implemented this interface. The method is called default because it provides functionality in case a 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.

Having a static method in an interface can provide functionality the same way a static method in a class can. As with a class static method (which can be called without class instantiation), an interface static method can also be called by adding the name of the interface in front of it.

A static interface method cannot be overridden by any class, including ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required