草庐IT

WithInner

全部标签

java - 在 Java 中使用带有引用的 super()

我有三个类(class)classWithInner{classInner{}}publicclassInheritInnerextendsWithInner.Inner{//constructorInheritInner(WithInnerwi){wi.super();}}这个例子摘自Eckel的ThinkinginJava。我不明白为什么我们不能调用wi=newWithInner();而不是.super()?在调用wi.super()时,我们正在调用Object的默认构造函数,不是吗? 最佳答案 内部类维护对外部实例的引用(st