Class, Abstract class, Interface, Extends and Implements | Core Java Tutorial

This Core Java Tutorial “Class, Abstract class, Interface, Extends and Implements” is providing information about how to use extends and implements keywords of Java while using classes, abstract classes and interfaces.


 

Class – Abstract Class – Interface :

  • Class can extends another Class.
  • Abstract class extends from another Abstract class.
  • Class of Abstract class can implements Interface.

Relations among Class, Interface, Abstract class

 

  • We can implement ‘Multiple Inheritance’ in Java using interfaces.
  • One class can extends only one class.
  • One class can implement more than one interface.
  • One interface can extends many interfaces (Multiple inheritance).
  • Following diagram describes the relation between classes, abstract class and interfaces.

Multiple Inheritance in Java

 

  • Following example explains all the relations of above diagram:

 

Share this