How can you use String methods to change the case of a string? Provide an example.

What will be an ideal response?


?The methods toUpperCase() and toLowerCase() convert any String to its uppercase or lowercase equivalent. For example, if you declare a String as String aWord = "something";, then the string "something" is created in memory and its address is assigned to aWord. The statement aWord = aWord.toUpperCase(); creates "SOMETHING" in memory and assigns its address to aWord. Because aWord now refers to "SOMETHING," aWord = aWord.toLowerCase(); alters aWord to refer to "something".

Computer Science & Information Technology

You might also like to view...

The design view for a select query is divided into three parts

Indicate whether the statement is true or false

Computer Science & Information Technology

Which of the following would allow a user to check for performance issues automatically in Windows 7?

A. Task Manager B. Upgrade Advisor C. Troubleshooting item in the Control Panel D. Device Manager in the Control Panel

Computer Science & Information Technology

ID attributes must be valid XML names and, therefore, they cannot contain _____ or begin with numbers.

A. ?spaces B. ?underscores C. ?capital letters D. ?mixed case letters

Computer Science & Information Technology

_______provide connection-oriented services.

a) Datagrams. b) UDPs. c) Stream sockets. d) None of the above.

Computer Science & Information Technology