肯定是跟内部类有关的,给个例子如下;class A { BBB bbb=new BBB(){ public void method1(){ this.test(); //将打印 BBB.test is called. A.this.test(); //将打印 A.test is called } public void test(){ System.out.println("BBB.test is called"); } } public void test(){ System.out.println("A.test is called"); } }interface BBB{ void method1(); void test(); }这样说,楼主应该很清楚了吧。
BBB bbb=new BBB(){
public void method1(){
this.test(); //将打印 BBB.test is called.
A.this.test(); //将打印 A.test is called
}
public void test(){
System.out.println("BBB.test is called");
}
} public void test(){
System.out.println("A.test is called");
}
}interface BBB{
void method1();
void test();
}这样说,楼主应该很清楚了吧。