Monday, June 25, 2018

WAP IN JAVA TO SHOW THE USE OF SUPER

class C
{
    int i;
}
class D extends C
{
    int i;
    D(int a,int b)
    {
        super.i=a;
        i=b;
    }
    void show()
    {
        System.out.println("i in Parent class: "+super.i);
        System.out.println("i in Child class: "+i);
    }
}
public class Eighteen {
    public static void main(String args[])
    {
        D subob=new D(4,5);
        subob.show();
    }
   
}



No comments:

Post a Comment