Java Interface Inheritance

Java Interface Inheritance

Java Interface Inheritance – Example – Explanation – Screenshot – Simple terms for a Beginner

Interfaces were introduced by the Java Designers to support multiple inheritance. Not only that, interfaces give a template methods from which new classes can be developed easily. Interface gives plan of methods required to achieve a task like a blue print for a house.

Interface should contain all abstract methods and not even one concrete method. This is where interface differs from abstract class. One more visible difference is using implements with interfaces and extends with abstract classes and concrete classes.

Following is the Example on Java Interface Inheritance

Java Interface InheritanceOutput Screenshot of Example on Java Interface Inheritance

The Java Interface Inheritance involves two interfaces Employee and Accounts and one class Officer implementing the interfaces. Being interfaces, they contain only abstract methods and Officer overriding all the abstract methods.

Following links of this same Web site gives you indepth knowledge of Interfaces

1. Another Example on interfaces: Interfaces – Partial implementation of Multiple Inheritance
2. Inheritance in between interfaces: Play with Implements
3. Inheritance with multiple interfaces and classes: Extends Implements

Leave a Reply

Your email address will not be published. Required fields are marked *