class A {
int x = 1;
class B {
int x = 2;
void func() {
int x = 3;
System.out.println( ? );
}
}
}
*/
public class Test07 {
public static void main(String[] args) {
// TODO Auto-generated method stub
//创建内部类对象
A.B oi = new A().new B();
oi.func();
}
}
class A {
int x = 1;
class B {
int x = 2;
void func() {
int x = 3;
System.out.println(x+"---"+this.x +"---"+new A().x );
}
}
}作者: 千里马 时间: 2014-10-2 23:06
public class Test7 {
public static void main(String args[]){
A a=new A();
A.B b=a.new B();
b.func();
}
}
class A {
int x = 1;
class B {
int x = 2;
void func() {
int x = 3;
System.out.println(A.this.x);
System.out.println(this.x);
System.out.println(x);
}
}
}