by Dinesh Thakur Category: array

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

About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.C.A, MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.

Related Articles