package inheritAnimals; public class Cat extends Pet{ // constructors not inherited, have to write public Cat() { // call superclass parameterized constructor super("Kitty", 1); } public Cat(String name, int age) { // call superclass parameterized constructor super(name, age); } // behavior not all Pets have // overload public void eat(Budgie food) { if (food == null) { // since name is protected in Pet, can use directly System.out.println(name + "didn't catch the bird"); } else { System.out.println(name + " eats " + food); } } // change how makeNoise method works @Override public void makeNoise() { System.out.println(name + " goes miaow"); } // overriding toString @Override public String toString() { return getName() + " (" + getAge() + "y.o. kitty)"; } }