import java.util.Scanner;
class superExample
{
    public static void main(String[] args)
    {
        Scanner sc=new Scanner(System.in);
        int a=sc.nextInt();
        int b=sc.nextInt();
        Subclass s=new Subclass(a,b);
        s.display();
    }
}
class Parent
{
    int a;
}
class Subclass extends Parent
{
    int b;
    Subclass(int a,int b)
    {
        super();
        this.a=a;
        this.b=b;
    }
    void display()
    {
        System.out.println("Accessing Parentclass variable using super keyword: "+a);
        System.out.println("Accessing subclass variable: "+b);
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: