Java – .equals() vs. == (What is the difference? Why do both exist?)

Опубликовано: 24 Июль 2026
на канале: The Self-Taught Software Engineer
334
16

Did you ever wonder why the Java programming language has two ways to compare for equality? There is the equals method as well as the == (double equals) operator. Do you want to learn what the difference between the two is and why Java offers both?
There are some important pitfalls to keep in mind!
In this video, I am going to show you how to compare two strings for equality, what reference equality and object equality are, and when to use which!

If you have any suggestions for content or feedback please leave them in the comments.

In case you enjoyed this video, make sure to leave like, subscribe and share it with anyone you could consider interested!