读书人

为什么要用this聊详细点

发布时间: 2013-12-04 17:21:02 作者: rapoo

为什么要用this,说详细点
package srcs;
interface Lol{
void show();
}
public class 内部类2 {

public static void main(String[] args){

Lol l=new Lol(){
public void show(){
System.out.println("A");
this.test();
}
public void test(){
System.out.println("B");
}
};
l.show();

Object o=new Object(){
public String toString(){
this.show();
return "C";

}
public void show(){
System.out.println("GG");
}
};
System.out.println(o);
}
}

读书人网 >J2SE开发

热点推荐