Java String equalsIgnoreCase() Method Last Updated : 23 Dec, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report In Java, equalsIgnoreCase() method of the String class compares two strings irrespective of the case (lower or upper) of the string. This method returns a boolean value, true if the argument is not null and represents an equivalent String ignoring case, else false.Input: str1 = "pAwAn"; str2 = "PAWan"Output: trueInput: str1 = "piwAn"; str2 = "PAWan"Output: falseExample: Java public class Geeks { public static void main(String[] args) { String str1 = "GeeKS FOr gEEks"; String str2 = "geeKs foR gEEKs"; String str3 = "ksgee orF geeks"; // Comparing str1 and str2 boolean res1 = str2.equalsIgnoreCase(str1); System.out.println("str2 is equal to str1 = "+ res1); // Comparing str2 and str3 boolean res2 = str2.equalsIgnoreCase(str3); System.out.println("str2 is equal to str3 = "+ res2); } } Outputstr2 is equal to str1 = true str2 is equal to str3 = false Syntax:str2.equalsIgnoreCase(str1);Here str1 is the string that is supposed to be compared.Return Value: A boolean value that is true if the argument is not null and it represents an equivalent String ignoring case, else false.Internal Implementationpublic boolean equalsIgnoreCase(String str) { return (this == str) ? true : (str != null) && (str.value.length == value.length) && regionMatches(true, 0, str, 0, value.length);} Comment More infoAdvertise with us Next Article Vector equals() Method in Java P pawan_asipu Follow Improve Article Tags : Misc Java Java-Strings Java-lang package Java-Functions +1 More Practice Tags : JavaJava-StringsMisc Similar Reads Java String compareToIgnoreCase() Method In Java, the String compareToIgnoreCase() method compares two Strings lexicographically means in dictionary order by ignoring the case differences. It evaluates the Unicode values of characters sequentially.Example 1: Here, we will use the compareToIgnoreCase() method to compare strings that are lex 2 min read Set equals() Method in Java In Java, the equals() method of the Set class is used to compare two sets for equality. It checks if two sets contain the same elements regardless of their order.Example 1: This example demonstrates how to compare two HashSet collections for equality of type string using the equals() method.Java// J 2 min read Vector equals() Method in Java The java.util.vector.equals(Object obj) method of Vector class in Java is used verify the equality of an Object with a vector and compare them. The list returns true only if both Vector contains same elements with same order. Syntax: first_vector.equals(second_vector) Parameters: This method accepts 2 min read YearMonth equals() method in Java The equals() method of YearMonth class in Java is used to compare two YearMonth objects. It compares this YearMonth object to the YearMonth object passed to it as parameter and checks if two YearMonth instances are equal or not. Syntax: public boolean equals(Object otherYearMonth) Parameter: This me 2 min read StringWriter equals() method in Java with Example The Java.io.StringWriter.equals(Object obj) method of StringWriter class in Java is used to check whether the two instances of StringWriter are equal or not. It returns a boolean stating whether they are equal or not. Signature: public boolean equals(StringWriter second_StringWriter) Syntax: first_S 2 min read Stack equals() method in Java with Example The Java.util.Stack.equals(Object obj) method of Stack class in Java is used verify the equality of an Object with a Stack and compare them. The list returns true only if both Stack contains same elements with same order. Syntax: first_Stack.equals(second_Stack) Parameters: This method accepts a man 2 min read Like