equals() vs hashCode() in Java | Internal Working & Real Use Cases

Опубликовано: 05 Май 2026
на канале: The Curious Coder
6,124
231

Confused between == and equals() in Java? Wondering what hashCode() does, or why you must override both equals() and hashCode() together?

This is one of the most commonly asked Java Core Interview Questions, and interviewers expect you to know not just the definitions but also the internal working and the contract between equals() and hashCode().
If you are preparing for Java interviews, mastering this concept is a must.

In this video, I explain everything you need to know about:
✔ == vs .equals() in Java
✔ equals() and hashCode() contract
✔ How HashMap works internally using hashCode() and equals()
✔ When and how to override equals() and hashCode() correctly
✔ Customizing your own logic for equals() and hashCode()
✔ Relation with Object class methods (equals(), hashCode())
✔ String equals() vs == Java
✔ Default implementation in Object class
✔ Role of equals() and hashCode() in Collections

00:00 : Introduction
01:08 : What you’ll learn
01:25 : Default Implementation of equals() in Object class
08:35 : Custom Implementation of equals()
15:01 : What is hashCode()
15:37 : Why is hashCode() needed
20:12 : Custom Implementation of hashCode()


Instagram :
  / the.curious_coder  


#interview #springboot #java