The equals() method is defined in String class in order to test whether two strings values are same sequence of characters. The method is for exclusively testing string objects, but not any other objects.
The operator ‘==’ always compares the variables but not objects. The ‘reference variables’ are compared with ‘==’, but not the objects. In terms of strings, the ‘==’ operator always compares the references and not the ‘character sequences’.