package interfaceExample; public class Cat implements Animal { private String animalName; public Cat(String nameIn) { animalName = nameIn; } public String getName() { return animalName; } public void setName(String nameIn) { animalName = nameIn; } public String makeSound() { return "meow"; } public String toString() { return animalName; } public boolean equals(Object other) { //Consider what happens if a non-Cat object // were to be passed in with the following. try { Cat localCat = (Cat)other; return this.getName().equals(localCat.getName()); } catch (Exception e) { return false; } } } //Copyright 2010-2016 : Evan Golub