== vs .equals(Object x) for Comparisons
“One of the Most Expensive Java Bugs Starts With ==”
Most developers know:
  • == compares references
  • .equals() compares values
But very few actually understand what’s happening inside JVM memory.
In this video, I break down:
  • how the String Pool works
  • why "Hello" == "Hello" returns true
  • why new String("Hello") changes everything
  • how Java reuses references internally
  • and how this tiny mistake silently causes production bugs
We’ll even visualize:
  • heap memory
  • pooled strings
  • object identity
  • and intern() behavior
Once you understand this, concepts like:
  • HashMap internals
  • caching
  • immutability
  • Hibernate equality
  • and JVM optimizations
23:54
5
7 comments
Ian Dancan
4
== vs .equals(Object x) for Comparisons
Amigoscode
skool.com/amigoscode
A free learning community led by Nelson Djalo. Master Programming & AI, get updates, and grow in a fast-moving industry.
Powered by