Please explain what is the contract between equals and hashCode of an object?
Submitted by: MuhammadThe only obligation is that for any objects o1 and o2 then if o1.equals(o2) is true then o1.hashCode() == o2.hashCode() is true.
Note that this relationship goes only one way: for any o1, o2 of some class C, where none of o1 and o2 are null, then it can happen that o1.hashCode() == o2.hashCode() is true BUT o1.equals(o2) is false.
Submitted by: Muhammad
Note that this relationship goes only one way: for any o1, o2 of some class C, where none of o1 and o2 are null, then it can happen that o1.hashCode() == o2.hashCode() is true BUT o1.equals(o2) is false.
Submitted by: Muhammad
Read Online Full Stack Developer (Java) Job Interview Questions And Answers
Top Full Stack Developer (Java) Questions
☺ | Tell me what is Bridge pattern? |
☺ | Can you please explain what is CORS? How does it work? |
☺ | Tell me what is your favorite language and why? |
☺ | Tell us are you aware of design patterns? |
☺ | Explain me what Are The Latest Trends In Full Stack Web Development? |
Top Java Programming Language Categories
☺ | Core Java Interview Questions. |
☺ | Hibernate Interview Questions. |
☺ | Advanced Java Interview Questions. |
☺ | IBM WebSphere Interview Questions. |
☺ | Spring Framework Interview Questions. |