Section 17.10 Additional Notes on Java SE 8 Interfaces

• Functional interfaces must contain only one abstract method, but may also contain default methods and static methods that are fully implemented in the interface declarations.

• When a class implements an interface with default methods and does not override them, the class inherits the default methods’ implementations. An interface’s designer can now evolve an interface by adding new default and static methods without breaking existing code that implements the interface.

• If one class inherits the same default method from two interfaces, the class must override that method; otherwise, the compiler will generate a compilation error.

• You can create your own functional interfaces by ensuring ...

Get Java™ How To Program (Early Objects), Tenth 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.