public class TheOne {
public class TheInOne{
TheInOne(int n){
System.out.println(n);
}
}
public static void main(String[] args){
TheTwo tt = new TheTwo(new TheOne(),1);
//TheOne.TheInOne tti = new TheOne().new TheInOne(123);
}
}
class TheTwo extends TheOne.TheInOne{//这里继承的不是TheOne,而是它的内部类!
TheTwo(TheOne to,int n){
to.super(n);//因为继承的是内部类,所以这里的super是指向TheInone;相当于new TheOne().new TheInOne(n)
}
} |