Question: what is the difference between java equals?
Answer: In simple words, == checks if both objects point to the same memory location whereas . equals() evaluates to the comparison of values in the objects. Explanation: Here we are creating two objects namely s1 and s2. Both s1 and s2 refers to different objects.