Object as Super Class in Java

Object as Super Class:

Object class in java.lang package, sits at top of the class hierarchy tree. Every class is a descendant, direct or indirect of object class

Hashcode and Equals Method():

Collections such as HashMap and HashSet use the hashcode value of an object to determine how the object should be stored in the collection, and the hashcode is used again to help locate the object in the collection.

Hashing retrieval is a two-step process.

  1. Find the right bucket (using hashCode())
  2. Search the bucket for the right element (using equals() )

If two objects are considered equal there hashcode must also be equal.

Software Developer