public class Base {
private int i = 2;public void display() { System.out.println(i);}public Base() { display();}
} public class Derived extends Base {
private int i = 22;public void display() { System.out.println(i);}public Derived() { i = 222;}public static void main(String[] args) { Derived d = new Derived();}
} 输出结果为0,子类与父类的变量都存在,父类构造方法,调用子类的display()方法