java (this)特殊用法

来源:互联网 发布:讨粤匪檄 知乎 编辑:程序博客网 时间:2024/06/10 01:23
作为方法名来初始化对象 

 public class Test { 

 public Test(){   

this(123);//在这里调用本类的另外的构造方法  

 public Test(int a){ 

 } 


 public static void main(String[] args) {   

Test t = new Test();  

}  

}
原创粉丝点击