O'Reilly logo

OCA Java SE 8 Programmer I Certification Guide by Mala Gupta

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

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 ...

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