Java – Extending interfaces

Home/Java - Tutorial/Java - Interfaces/Java – Extending interfaces
Java – Extending interfaces 2017-08-09T12:15:17+00:00

Java Extending interfaces :

One interface can inherit another by use of the keyword extends. The syntax is the same as for inheriting classes.

When a class implements an interface that inherits another interface,

It must provide implementation of all methods defined within the interface inheritance.

Note : Any class that implements an interface must implement all methods defined by that interface, including any that inherited from other interfaces.

EX :


 


Output :
This is display of i1
This is display of i2

Note : We have to define disp1() and disp2() in cls1.

Multiple inheritance using interface..


 


Output :
Displaying student details ..
Rollno = 1912
Name = Ram
Marks = 75

We can make various forms of interface implementation as below

Prev Next