10.10 Java SE 8 Interface Enhancements
This section introduces interface features that were added in Java SE 8. We discuss these in more detail in later chapters.
10.10.1 default
Interface Methods
Prior to Java SE 8, interface methods could be only public abstract
methods. This meant that an interface specified what operations an implementing class must perform but not how the class should perform them.
As of Java SE 8, interfaces also may contain public
default
methods with concrete default implementations that specify how operations are performed when an implementing class does not override the methods. If a class implements such an interface, the class also receives the interface’s default
implementations (if any). To declare a default ...
Get Java How to Program, Early Objects, 11th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.