protected class Yolk {
public Yolk() { System.out.println( "Egg.Yolk()" ); }
public void f() { System.out.println( "Egg.Yolk().f()" ); }
}
private Yolk y = new Yolk( );
public Egg() { System.out.println( "new Egg()" ); }
public void insertYolk( Yolk yy ) { y = yy; }
public void g() { y.f(); }
}
public class BigEgg extends Egg {
public class Yolk extends Egg.Yolk {
public Yolk() { System.out.println( "BigEgg.Yolk()" ); }
public void f() { System.out.println( "BigEgg.Yolk().f()" ); }
}
public BigEgg() { insertYolk( new Yolk() ); }
public static void main( String[] args) {
Egg e = new BigEgg();
e.g();
}
}
大家认为这个程序输出的是什么!!
有能力的请解释哈!(可以把解释的内容写到语句的后面)
[此贴子已经被作者于2006-8-18 13:35:01编辑过]