// an example to illustrate the differences between shadow // and override. // burton rosenberg 1 July 1997 class A { int i = 0 ; void f() { System.out.println("A.f") ; } } class B extends A { int i = 1 ; void f() { System.out.println("B.f") ; } } class C extends B { int i = 2 ; void f() { System.out.println("C.f") ; } } public class Example2 { public static void main( String [] args ) { C c = new C() ; B b = c ; A a = b ; System.out.println( "c.i=" + c.i + ", b.i=" + b.i + ", a.i ="+ a.i ) ; c.f() ; b.f() ; a.f() ; } }