When you make new class, say Dog.
When you make 2 objects with the same weight, and invoke equals method
it will give you false. Because the equals is a method you inherit from Object. in equals of Object, it simple estimate if the two references refer to the same object. And a and b refer to different Dog objects. So you get false.
To solve that,
you should override the equals method.
say:
hashCode method is required to be overriden when you override equals,
that is a bit complex.. understand the equals first.