What are uses of Hash Code?

Answer Posted / suraj kumar

1. When equals() method is invoked on java objects to check
their equality, then the hash code of objects are checked. The
two objects having same hash code are equal.
2. The objects having distinct hash code in HashTable
increases the performance of HashTable. Hence, the objects
should be checked its distinct hash code before storing into
HashTable.

Is This Answer Correct ?    16 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is boolean false?

766


What is boolean law?

749


How do you check if a character in a string is a digit or letter?

823


What is the benefit of singleton pattern?

770


Can we call a non-static method from inside a static method?

800


Explain the pointers in Java?

826


What is rule of accessibility in java?

789


Is alive in java?

732


Explain what pure virtual function is?

810


What does the exclamation mark mean in java?

953


explain local datetime api in java8?

801


Why is flag used in java?

775


Does java support function overloading, pointers, structures, unions or linked lists?

855


Is empty .java file name a valid source file name?

830


Where is stringbuffer stored?

781