Please see the ollowing code /CODE public class C { int i =1; public void foo() { System.out.println("C foo()"); } public static void main(String args[]) { new D().run(new D()); } } class D extends C { int i =2; public void foo() { System.out.println("D foo()"); } public void run(C ac) { System.out.println(ac.i); foo(); } } the result is 1 D foo(). Can somebode explain me how is it 1.I thought it should be 2 D foo().
[This message has been edited by Sunita Vontel (edited August 31, 2000).] [This message has been edited by Sunita Vontel (edited August 31, 2000).]