Posted in: Java interview questions == operator is used to compare the references of the objects.public bollean equals(Object o) is the method provided by the Object class. The default implementation uses == operator to compare two objects.But since the method can be overriden like for String class. equals() method can be used to compare the values of two objects.