Difference between hashCode() & equals()?

Answers were Sorted based on User's Feedback



Difference between hashCode() & equals()?..

Answer / rohan

equals() method of string class compares the contaits of string
equals() method of object class compares the address of objects
Hashcode() method returns the unique identification code of
particular object.

Is This Answer Correct ?    4 Yes 0 No

Difference between hashCode() & equals()?..

Answer / srikanth

hashCode() method returns integer no assigned by jvm
ie ...it is for identifying objects in heap memory very
fastly

equals() it is for comparing addreess of objects

Is This Answer Correct ?    4 Yes 2 No

Difference between hashCode() & equals()?..

Answer / srikanth

hashCode() method returns integer no assigned by jvm
ie ...it is for identifying objects in heap memory very
fastly

equals() it is for comparing addreess of objects

Is This Answer Correct ?    3 Yes 3 No

Post New Answer

More Core Java Interview Questions

What ide should I use for java?

0 Answers  


What comes to mind when someone mentions a shallow copy in java?

0 Answers  


What are byte codes?

0 Answers  


In the HashMap, we know the values but we dont know the key, then how can we get the key from HashMap ?????

4 Answers   Kanbay,


Explain the difference between abstract class and interface in java?

0 Answers  






what is an object class?Explain its methods?

6 Answers  


How do you declare a destructor in java?

0 Answers  


Explain the difference between private, public, package and protected in java?

0 Answers  


Difference between interface and abstract class with ex.

4 Answers   Cognizant, Tech Mahindra,


What do you mean by singleton class in java?

0 Answers  


How do you decide when to use arraylist and linkedlist?

0 Answers  


Tell me are there implementations for sorting and searching in the java libarary?

0 Answers  


Categories