Step one, make a constructor that takes a String
and an int
.
Parrot(String name, int age)
{
this.age = age;
this.name = name;
}
Step two, call that constructor with a hardcoded default name
and an age
provided. Use this
. Like
Parrot(int i)
{
this("Polly", i);
}
solved How to call a constructor within a second constructor?