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. Tip: Use the compareToIgnoreCase() method to compare two strings lexicographically, ignoring case differences.
Read moreWhat is compareTo method?
The compareTo method compares the current object with the object sent as a parameter . When implementing it, we need to make sure that the method returns: A positive integer, if the current object is greater than the parameter object. A negative integer, if the current object is less than the parameter object.
Read moreWhat is the difference between equals () and equalsIgnoreCase () methods?
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 moreWhat is the difference between compareTo and compare with?
To compare to is to point out or imply resemblances between objects regarded as essentially of a different order; to compare with is mainly to point out differences between objects regarded as essentially of the same order.
Read more