the api of contains() method says
\"Returns true if this list contains the specified element. More formally, returns true if and only if this list conta
You overloaded equals instead of overriding it. To override Object's equals method, you must use the same signature, which means the argument must be of Object type.
Change to:
@Override
public boolean equals(Object other){
if (!(other instanceof Animal))
return false;
Animal otherAnimal = (Animal) other;
return (this.legs==otherAnimal.legs) &&
(this.getClass().getName().equals(otherAnimal.getClass().getName()));
}