Ramp interview question

They asked me to explain the difference between == and .equals() in Java and when to use each.

Interview Answer

Anonymous

9 Oct 2025

I explained that == compares object references (memory locations), while .equals() compares the actual content or value of the objects (if overridden). For example, two different String objects with the same text are equal by .equals() but not by ==.