1、构造方法

public class AnyThing {
    
    public AnyThing(){                              //定义无参构造方法
           this("this 调用有参构造方法");          //使用this关键字调用有参构造方法
    
    System.out.println("无参构造方法");
}
    public AnyThing(String name){                  //定义有参构造方法
        
        System.out.println("有参构造方法");
        
    }
}
原文地址:https://www.cnblogs.com/as1234as/p/5138251.html