Java String equalsIgnoreCase() Method Last Updated : 23 Dec, 2024 Comments Improve Suggest changes 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 Java String equalsIgnoreCase() Method 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 Overriding equals method in Java Consider the following Java program: Java class Complex { private double re, im; public Complex(double re, double im) { this.re = re; this.im = im; } } // Driver class to test the Complex class public class Main { public static void main(String[] args) { Complex c1 = new Complex(10, 15); Complex c2 3 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 Java String contentEquals() Method with Examples contentEquals() method of String class is used to compare the strings. There are two types of contentEquals method available in java.lang.String with different parameters: contentEquals(StringBuffer sb)contentEquals(CharSequence cs)1. contentEquals(StringBuffer sb): contentEquals(StringBuffer sb) me 3 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 Java String contains() Method with Example The String.contains() method is used to search for a sequence of characters within a string. In this article, we will learn how to effectively use the string contains functionality in Java.Example:In this example, we check if a specific substring is present in the given string.Java// Java Program to 3 min read Short equals() method in Java with Examples The equals() method of Short class is a built in method in Java which is used to compare the equality given Object with the instance of Short invoking the equals() method. Syntax ShortObject.equals(Object a) Parameters: It takes an Object type object a as input which is to be compared with the insta 2 min read Like