thx for reading.
I need to create constructor, which in one case has default values example below. this code is wrong of course, Is it possible to do that it means in case "dog" constructor will not ask for parameters: weight, age and will fill up class fields: weight=1, age=1. In another case for example cat will ask for all parameters? How usually this problem is solved?
public Animal(String spacies, String name, double weight, byte age, boolean isALive){
if (spacies.equals("dog")) {
this.name = name;
this.weight= 1;
this.age = 1;
this.isALive = isALive;
} else {
this.spacies = spacies;
this.name = name;
this.weight = weight;
this.age = age;
this.isALive = isALive;
}
}