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

You might also like to view...

Which data structure maintains the event set in an event-driven simula tion?

a. STL set b. STL map c. priority queue d. queue e. stack

Computer Science & Information Technology

Rules that you create run for ____ received after you create the rule.

A. all incoming email messages B. flagged incoming email messages C. email messages marked high importance D. email messages in html

Computer Science & Information Technology

A Microsoft Office ________ guides you through the steps necessary to finish a complicated task

Fill in the blank(s) with correct word

Computer Science & Information Technology

The process of applying design rules and principles to ensure that your database performs as expected is known as ________

Fill in the blank(s) with correct word

Computer Science & Information Technology