不在同一个外部类的内部类(在同一个类中)中的变量不能用this吗,要怎么用?
前后两个报错:
The public type a must be defined in its own file
No enclosing instance of the type a.innerC.innerD is accessible in scope
像这样:
(代码:不管空格了)
public class a{
public class innerA{
public class innerB{
public void method4(){
System.out.println("a.innerC.innerD.this.var3:"+a.innerC.innerD.this.var3);
}
}
}
public class innerC{
public class innerD{
public int var3=23;
}
}
}