equals() Method in Java. Both equals() method and the == operator are used to compare two objects in Java. == is an operator and equals() is method . But == operator compares reference or memory location of objects in a heap, whether they point to the same location or not.
Read moreWhat is the difference between equals and compareTo in Java?
The 2 main differences are that: equals will take any Object as a parameter, but compareTo will only take Strings . equals only tells you whether they’re equal or not, but compareTo gives information on how the Strings compare lexicographically.
Read moreWhat does equalsIgnoreCase mean in Java?
The equalsIgnoreCase() method compares two strings, ignoring lower case and upper case differences . This method returns true if the strings are equal, and false if not.
Read moreWhat is difference between equals and equalsIgnoreCase in Java?
The only difference between them is that the equals() methods considers the case while equalsIgnoreCase() methods ignores the case during comparison . For e.g. The equals() method would return false if we compare the strings “TEXT” and “text” however equalsIgnoreCase() would return true.
Read more