Multilevel inheritance

PHOTO EMBED

Mon Jan 08 2024 18:10:50 GMT+0000 (Coordinated Universal Time)

Saved by @E23CSEU1151 #java

class A
{
    int a; int b; int c;
    void ADD()
    {
        a=1;
        b=2;
        c=a+b;
        System.out.println("addition of number "+c );
    }
    void SUB()
    {
        a=1;
        b=2;
        c=a-b;
        System.out.println("subtraction of number "+c );
    }
}
class B extends A
{
    void MULTI()
    {
        a=1;
        b=2;
        c=a*b;
        System.out.println("multiplication of number "+c );
    }
}
class C extends B
{
        void REMAINDER()
    {
        a=1;
        b=2;
        c=a%b;
        System.out.println("remainder of number "+c );
    }
}
class D{
    public static void main(String[] args)
    {
        C r = new C();
        r.ADD();
        r.SUB();
        r.MULTI();
        r.REMAINDER();
    }
}
content_copyCOPY