You are here: Home / Topics / Program to explain Inheritance of a interface from multiple interfaces

Program to explain Inheritance of a interface from multiple interfaces

Filed under: Java on 2023-09-17 13:17:28

//  Program to explain Inheritance of a interface
// from multiple interfaces.


interface A
{
void showA();
}

interface B 
{
void showB();
}

interface C extends  A, B
{
void showC();
}

class  D  implements  C
{
public void showA()
{
 System.out.println("showA() of A interface.");
}

public void showB()
{
 System.out.println("showB() of B interface.");
}

public void showC()
{
 System.out.println("showC() of C interface.");
}
}

class  InterfaceTest5
{
public static void main( String args[ ] )
{
 C c1 = new  D();
 c1.showA();
 c1.showB();
 c1.showC();
}
}


Output:

showA() of A interface.
showB() of B interface.
showC() of C interface.

About Author:
M
Mr. Dubey     View Profile
Founder and CEO of MCQ Buddy. I just like to help others.