// A program to demonstrate multi-level overriding 
// Driver class
class Multilevel {
  public static void main( String[ ] args ) {
    Parent obj1 = new GrandChild( );
    obj1.show( );
  }
}
// Base class 
class Parent {
  void show( ) { System.out.println( "Parent's show( )" ); } 
} 
// Inherited class 
class Child extends Parent { 
  // This method overrides show( ) of Parent. 
  void show( ) { System.out.println( "Child's show( )" ); } 
} 
// Inherited class 
class GrandChild extends Child {
  // This method overrides show( ) of Parent. 
  void show( ) { System.out.println( "GrandChild's show( )" ); } 
}
    
    |