A
B
C
D
// Hierarchical inheritance // Driver class public class Hierarchical { public static void main( String[ ] args ) { C c1 = new C( ); c1.printName( args[0] ); B b1 = new B( ); b1.printFor ( ); c1.printName( args[0] ); D d1 = new D( ); d1.printFor ( ); d1.printName( args[0] ); } } class A { public void printName( String name ) { System.out.print( name ); } public void printFor( ) { System.out.print( " for " ); } } class B extends A { public void printFor( ) { System.out.print( " 4 " ); } } class C extends A { } class D extends A { }