本帖最后由 微凉的暮色 于 2015-6-29 18:39 编辑
package lianxi;
public class Outer {
int num = 8;
public void method(){
final int num = 5;//-->怎么访问这个
class Inner{
int num = 3;
public void show(){
System.out.println(num); //结果:3
System.out.println(this.num); //结果:3
System.out.println(Outer.this.num); //结果:8
}
}
Inner in = new Inner();
in.show();
}
public static void main(String[] args) {
new Outer().method();
}
}
|
|