Java program for multiple inheritance using three interfaces


In this program, You will learn how to implement multiple inheritance using three interfaces in java.


interface A{ }

interface B{ }

interface C{ }

class Main implements A, B, C { }

Example: How to implement multiple inheritance using three interfaces in java.

interface A {
    int a = 10;
}

interface B {
    int b = 20;
}

interface C {

    int c = 30;
}

class Main implements A, B, C {

    void add() {
        int sum = a + b + c;
        System.out.println("The sum is : " + sum);
    }

    public static void main(String args[]) {
        Main obj = new Main();
        obj.add();
    }
}

Output:

The sum is : 60