abstract class SuperParent
{
public abstract void Show();
public void Display()
{
System.out.println("HI............I m ur grandpa and in Display()");
}
}
abstract class Parent extends SuperParent
{
public abstract void Detail();
public void Show()
{
System.out.println("implemented abstract Show()method of Superparent in parent thru super");
}
public void Display()
{
System.out.println("Override display() method of Superparent in parent thru super");
}
}
public class Child extends Parent
{
Child()
{
super.Show();
super.Display();
}
public void Show()
{
System.out.println("Override show() method of parent in Child");
}
public void Detail()
{
System.out.println("implemented abstract Detail()method of parent ");
}
public void Display()
{
System.out.println("Override display() method of Superparent and Parent in child ");
}
public static void main(String[] args) {
Child c1= new Child();
c1.Show();
c1.Display();
Parent p1=new Child();
p1.Detail();
p1.Display();
p1.Show();
}
}
I create a abstract class superparent with one abstract method show() and one concrete method Display().Now we create a Parent class extends superparent with one abstract method detail()and concrete method display() which is override from superparent and implement show() method which is abstract in superparent ,now i create a child class extends Parent,with implement method Detail() which is abstract in Parent and overide display() method which is in parent and superparent and overide show() which is in parent. now i create a instance of child and run all method and it call all child method,fine.and if we want to run parent method then we use super.parent method in constructor,run fine .but how i run superparent method display() from child class.