構造函數之間調用只能用this關鍵字,通過參數區分所調用的構造函數
可以這樣理解: this.age中的this爲this關鍵字,而this(age)中的this爲this語句,它起到調用函數的作用.the example:
private String name;
private int age;
public TestConstructor(String name){
this.name=name;
}
public TestConstructor(int age,String name){
this(name);
this.age=age;
}