Multiple Inheritance
interface FirstInterface {
public void display_1(int a);
}
interface SecondInterface {
public void display_2(String a);
}
public class MultipleInheritance implements FirstInterface, SecondInterface {
/* Multi level inheritance is possible in java only through interfaces */
@Override
public void display_1(int a) {
System.out.println("Inside display_1 accepting integer argument " + a);
}
@Override
public void display_2(String a) {
System.out.println("Inside display_2 accepting String argument " + a);
}
public static void main(String[] args) {
MultipleInheritance mul = new MultipleInheritance();
mul.display_1(100);
mul.display_2("HELLO WORLD..!!");
}
}
Output:
Inside display_1 accepting integer argument 100
Inside display_2 accepting String argument HELLO WORLD..!!