How is the String class equalsIgnoreCase() method like the equals() method and how would you use it? Give an example.
What will be an ideal response?
TheStringclassequalsIgnoreCase()method is similar to theequals()method. As its name implies, this method ignores case when determining if twoStrings are equivalent. Thus, if you declare aStringasString aName = "Carmen";, thenaName.equals("caRMen")isfalse, butaName.equalsIgnoreCase("caRMen")istruesincethe equalsIgnoreCase() method allows you to test entered data without regard to capitalization. This method is useful when users type responses to prompts in your programs. You cannot predict when a user might use the Shift key or the Caps Lock key during data entry.
Computer Science & Information Technology