Mastering Java: The Ultimate Quiz for 'Thinking in Java'

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for your Java exam with our ultimate quiz based on 'Thinking in Java'. Engage with expertly crafted questions that enhance your learning process. Perfect for Java enthusiasts looking to solidify their knowledge!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


What method produces a new String object with all letters changed to lowercase?

  1. tolowerCase()

  2. toLowerCase()

  3. lower()

  4. convertToLower()

The correct answer is: toLowerCase()

The method toLowerCase() is the only built-in method in Java that changes all letters in a String to lowercase. Option A, tolowerCase(), is incorrect because it includes a typo and is not a valid method name. Option C, lower(), is incorrect because it is not a built-in method in Java. Option D, convertToLower(), is incorrect because it is not a valid method name in Java and there is no built-in method with this name. Therefore, the correct answer is B, toLowerCase().