October 2017
Beginner
318 pages
7h 26m
English
Overriding an Object class method is no more difficult than overriding the method for any other superclass. We simply declare an identical method, and this specific method will be used when appropriate, when we're dealing with a MyClass object. It's important for us to notice that the equals() method does not take a MyClass object as input; it takes any object as input. So, before we can go ahead and compare this object's value with the value of our current MyClass objects, we need to protect ourselves and make sure that the object given as input is actually a MyClass object.
To do this, let's check some bad cases where we would want our program to simply go ahead and return false without even comparing the ...
Read now
Unlock full access