Figure 6.13. The interface MyInterface extends the interfaces BaseInterface1 and BaseInterface2.
interface BaseInterface1 { String getName(); } interface BaseInterface2 { String getName(); } interface MyInterface extends BaseInterface1, BaseInterface2 {}
Because neither of the getName methods defined in BaseInterface1 and Base-Interface2 define a method body (as shown in figure 6.14), the question of which of the methods MyInterface inherits is irrelevant. The interface MyInterface has access to a single getName method, which must be implemented by all the concrete classes that implement MyInterface.
Figure 6.14. Methods defined in an interface ...
Get OCA Java SE 8 Programmer I Certification Guide 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.