一般方法之间是可以相互调用的,那么构造方法之间相互调用该如何去编写代码。
this调用构造方法的格式是this(参数列表);
this还可以解决成员变量和局部变量重名问题
public class Person(){
private String name;
private int age;
public Person(String name,int age){
this.name = name;
this.age = age;
}
get/set省略
}