Preview:
Summary
== checks for reference equality (i.e., whether two references point to the same object).
hashCode() is used in hash-based collections to quickly locate objects.
If == returns true, the hashCode() values of the two objects will be the same.
If equals() is overridden, hashCode() must also be overridden to ensure that equal objects have the same hash code.
Important: Two distinct objects can have the same hashCode(), but equal objects (as determined by equals()) must have the same hashCode().
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter