class A {
int x = 1;
class B {
int x = 2;
void func() {
int x = 3;
//打印A中的x
System.out.println(A.this.x);
//打印B的变量x
System.out.println(this.x);
//打印func中的x
System.out.println(x);
}
}
}
public class Test5 {
public static void main(String[] args) {
A a= new A();
A.B b=a.new B();
b.func();
}
}
|
|