Computer Applications

Which of the following is the CORRECT java statement to convert the word RESPECT to lowercase?

  1. "RESPECT".tolowercase( );
  2. "RESPECT".toLowerCase( );
  3. toLowerCase("RESPECT");
  4. String.toLowerCase("RESPECT");

Java String Handling

1 Like

Answer

"RESPECT".toLowerCase( );

Reason — The method to convert a string to lowercase in Java is toLowerCase(), which is called on a string object. It is case-sensitive and must be written exactly as toLowerCase(). Therefore, "RESPECT".toLowerCase() correctly converts the string "RESPECT" to lowercase.

Answered By

2 Likes


Related Questions