Lab 18
AIM: Write a program in Java in which a subclass constructor invokes the constructor of the super class and instantiate the values.

MainClass.java
class SuperClass
{
    int x;
    SuperClass(int a)
    {
        x=a;
        System.out.println("Super Class : " +x);
    }
}
class SubClass extends SuperClass
{
    int y;
    SubClass(int l,int m)
    {
        super(l);
        y=m;
        System.out.println("Sub class : "+y);
    }
}
class MainClass
{
    public static void main(String arg[])
    {
        SubClass s=new SubClass(5,4);
    }
}

Output

subclass constroctor invokes the construcor of the super class
subclass constructor invokes the constructor of the super class and instantiate the values in java by practical server

Happy Coding :)