In Java, two commonly used methods for comparison are the “==” operator and the equals(). In this article, we are going to discuss the relation between the “==” operator and the equals() method.

- If two objects are equal by the == operator then these two objects are always equal by the equals() method. If O1 == O2 is true then O1.equals(O2) is always true.
- If two objects are not equal by the == operator then we can not conclude anything about the equals() method. If O1 == O2 is false then O1.equals(O2) may return true or false.
- If two objects are equal by equals() then we can not conclude anything about == operator. It may return true or false.
- If two objects are not equal by equals() then these two objects are also not equal by == operator.

**Similar Java Tutorials**