Login with  Log in with facebook
Hiring Manager? SIGN UP HERE
0   equals and ?

in a java class if you are overriding equals method which is the other method you should override and why

Rishi Yadav
08/05/2011 at 20:53
1 Answer

If we override the equal method of java.lang.Object than we need to override the hashCode() method too, otherwise it will give the unexpected errors. Overridding this method is necessary as when we compare the two objects with equal and if they are same then they should also return same hashcode.If we dont override it then it might give unexpected errors.

Poonam Sutaria
08/06/2011 at 18:01

If you want to post any answer to this forum then you need to log in.
Schedule a Demo

Schedule a Demo with us

Name *
Email *
Phone *
Company *