by Dinesh Thakur

The String class includes several methods that compare strings or substrings within strings. To perform a comparison that ignores case differences, use equalsIgnoreCase(). This method considers lowercase and upper case characters as same while comparing strings. That is, it considers A-Z to be the same as a-z.


boolean equalsIgnoreCase(String str)


Here, str is the String object being compared with the invoking String object. It returns true if the strings contain the same characters in the same order, and false otherwise.


class StringComparison
            public static void main(String args[]) throws IOException
                        BufferedReader dd=new BufferedReader(new InputStreamReader(;
                        String ww;
                        System.out.println("Enter Few Strings or Enter stop to Exit ");

String Comparison in Java Example