Yes, by using this() syntax. E.g.
public Pet(int id) { this.id = id; // “this” means this object } public Pet (int id, String type) { this(id); // calls constructor public Pet(int id) this.type = type; // ”this” means this object }
Yes, by using this() syntax. E.g.
public Pet(int id) { this.id = id; // “this” means this object } public Pet (int id, String type) { this(id); // calls constructor public Pet(int id) this.type = type; // ”this” means this object }