New course! Every coder should learn Generative AI!
Try a free lesson+ 3
In Java we can test for reference equality with "==", and two objects are only reference-equal if they occupy the same space in memory, that is, if its really just one object being compared with itself.
That's often not a useful check to do and all we want to know is whether two objects "look" the same; typically each class in Java implements it's own .equals() method that is used for semantic comparison of objects.