Java Program using a super keyword with arguments


In this program, You will learn how to implement a super keyword with arguments in java.


System.out.println(super.x, super.y);

Example: How to implement a super keyword with arguments in java.

class First {
    int x = 10,y=11;
    void print(int a, int b) {
        System.out.println("The value is :" + (a+b));
    }
}

class Main extends First {

    int x = 33,y=66;
    void display() {
        print(super.x, super.y);
    }

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

Output:

The value is :21