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 are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. Import java.net.* Versus import java.net.socket)?

592


What is double in java?

518


What does string mean in java?

630


What is a final class ?

605


Find the value of a specified element of the array arr[i] where 0 <= i <= n-1

544






Can you have two constructors in java?

503


Is java an ide?

527


What is the string function?

557


What is object-oriented paradigm?

617


Difference between object instantiation and construction ?

582


What is the difference between an interface and an abstract class?

542


What are the characteristics of java?

527


How is a variable stored in memory?

531


What is numeric function?

542


Can we have any code between try and catch blocks?

563