35.multilevel_inheritance
/*multilevel inheritance
A
|
B
|
C
*/
class A
{
void showA()
{
System.out.println("showA method of class A called");
}
}
class B extends A
{
void showB()
{
System.out.println("showB method of class B called");
}
}
class C extends B
{
void showC()
{
System.out.println("showC method of class C called");
}
}
class multilevel_inheritance{
public static void main(String[] args) {
C obj = new C();
obj.showA();
obj.showB();
obj.showC();
}
}
OUTPUT:
showA method of class A called
showB method of class B called
showC method of class C called
Comments
Post a Comment