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

Explain the concept of proper inheritance?

829


Can we modify the throws clause of the superclass method while overriding it in the subclass?

783


How do you sort arraylist in descending order?

790


What are the three parts of a lambda expression? What is the type of lambda expression?

812


Which java ide is used the most?

762


What is the epoch date?

743


What is flush buffer?

752


How are destructors defined in java?

801


Is sizeof a preprocessor?

740


How do you find the independent variable?

743


What type of value does sizeof return?

776


What are basic keywords?

802


What is synchronization and why is it important in java programming?

715


Does java allow overriding static methods ?

842


How many bytes is a string in java?

728