It is simple, Object class equals
method signature is this
public boolean equals(Object obj)
But if you write equals
method with Animal
parameter then it will not be the Overridden
equals method from object class. and when you try to compare objects by using .equals()
Object class equals will be invoked
For this reason and to make it clear it is always recommended to use @Override
annotation