Sobes.tech
Junior — Middle

How is object comparison performed using the equals method when its algorithms are not overridden?

sobes.tech AI

Answer from AI

If the equals method is not overridden in a class, the implementation from the Object class is used. In this case, the comparison is based on references — meaning the method returns true only if both variables refer to the same object in memory. Therefore, without overriding equals, the addresses of the objects are compared, not their contents.