Write above program having inside method of child class call method of super class using keyword super. Instantiate all class’s object and using it call appropriate method.


class SuperClass
{
    void simple()
    {
        System.out.println("Super Class are calling");
    }
}
class SubClass extends SuperClass
{   
    void simple()
    {
        super.simple();
        System.out.println("Sub Class are calling");
    }
}
class Simple
{
    public static void main(String args[])
    {
        SubClass child=new SubClass();
        child.simple();
    }
}

0 comments:

Post a Comment

Digital Marketing

Subscribe to RSS Feed Follow me on Twitter!