应该是class inner 的句柄,因为只是扩展内部类,而不是内部类
解决方案 »
- 谁能帮我看几行代码啊??谢谢了!
- JAVA
- jdk 帮助 文档中 这句话什么意思
- 重发:getColumnName()怎么和getColumnLabel()一样?怎么才能得到字段名? java ResultSetMetaData
- 关于线程的问题
- setContentPane() 和getContentPane().add()的区别?
- 急阿,请问抛出java.io.EOFException异常如何解决???
- Java里面有没有win32里面的类似于getSystemMetrics的API?
- List<A>和List<B>形成新的List<C>有要求的生成
- 问题没人能回答,到是散了不少分,唉!
- 收集JAVA中的正则表达式的用法
- 怎么查看对象的地址?100分呵
WithInner() {System.out.println("withInner");}
class Inner{
Inner() {System.out.println("Inner");}
}
}
class InheritInner extends WithInner.Inner
{
InheritInner(WithInner wi) {
wi.super();
System.out.println("InheritInner");
} //请问wi.super()怎么理解
}
public class q{
public static void main(String[] args){
WithInner wi = new WithInner();
System.out.println("XXXXXXXXXXXXX");
InheritInner ii = new InheritInner(wi);
}
}
/*****************************************************************************/
Console:withInner
XXXXXXXXXXXXX
Inner
InheritInner---------------------------------------------------------------------------
super:子类继承父类的构造方法时,子类如果使用父类的构造方法必须在子类的构造方法中用super关键字.这里的super这是调用InheritInner 父类的构造方法.只不过Inner 是WithInner的内隐类.所以用WithInner的对象来调用super
//: c08:InheritInner.java
// Inheriting an inner class.class WithInner {
class Inner {}
}public class InheritInner extends WithInner.Inner {
//! InheritInner() {} // Won't compile
InheritInner(WithInner wi) {
wi.super();
}
public static void main(String[] args) {
WithInner wi = new WithInner();
InheritInner ii = new InheritInner(wi);
}
} ///:~You can see that InheritInner is extending only the inner class, not the outer one. But when it comes time to create a constructor, the default one is no good, and you can’t just pass a reference to an enclosing object. In addition, you must use the syntax Feedback
enclosingClassReference.super();inside the constructor. This provides the necessary reference, and the program will then compile. Feedback