In this section, you will get the detailed explanation about the
equalsIgnoreCase(String Str)
method of String class. We are going to use equalsIgnoreCase(String Str)
method of String class in Java. The description of the code is given below for the usage of the method.
Description of the code:
As shown in the example below we have taken three strings i.e. str1, str2 and str3. Then we have applied the equalsIgnoreCase(String Str) method to compare these three strings. This method shows whether two String objects contain the same data, ignoring the case of the letters in the String. Hence we get the following output.
If atleast one of the following is true then only two characters c1 and c2 are considered the same, ignoring case.
|
Here is the code of the program:
| C:\unique>javac equalsIgnore.java C:\unique>java equalsIgnore "bon voyage" equals "Bon Appetit"? false "bon voyage" equals "Bon Voyage"? true C:\unique> |
|
Recommend the tutorial |
Ask Questions? Discuss: String equalsIgnoreCase(String Str) View All Comments
Post your Comment