CODE:
class
Grandparent
{
public
void Print()
{
System.out.println("Hello!
From GrandParent.");
}
}
class
Parent extends Grandparent
{
public
void Print()
{
super.Print();
System.out.println("Hello!
From Parent.");
}
}
class
Child extends Parent
{
public
void Print()
{
super.Print();
System.out.println("Hello!
From Child.");
}
}
public
class EXP18Q1
{
public
static void main(String[] args)
{
Child
c = new Child();
c.Print();
}
}
OUTPUT:
Comments
Post a Comment