首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

为什么要用this,聊详细点

2013-12-04 
为什么要用this,说详细点package srcsinterface Lol{void show()}public class 内部类2 {public static

为什么要用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);
}
}

热点排行