Results 1 to 2 of 2

Thread: Java related

  1. #1
    Junior Member
    Join Date
    May 2007
    Answers
    1

    Java related

    Why do you need to override Hashcode? what happens if you don't?


  2. #2
    Junior Member
    Join Date
    May 2007
    Answers
    10

    Re: Java related

    Hi

    If two objects are equal, their hash code must also be equal. If you override the equals() method, you change the way two objects are equated and Object's implementation of hashCode() is no longer valid. Therefore, if you override the equals() method, you must also override the hashCode() method as well.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact