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

this.成员变量:目前类的变量,this.方法:当前运行类的方法

2013-11-03 
this.成员变量:当前类的变量,this.方法:当前运行类的方法!public class Test {void test() {this.test1()

this.成员变量:当前类的变量,this.方法:当前运行类的方法!


public class Test {
   void test() {
  this.test1();
   }
   void test1() {
  System.out.println("test");
   }

}




public class Test1  extends Test{
  void test1() {
 System.out.println("err");
  }
  public static void main(String[] args) {
Test1 t=new Test1();
t.test();
}
}


结果是:err  

去掉this,结果也是err


热点排行