Way2Java

toLowerCase() String Example

java.lang.String class comes with toLowerCase() String method to convert all uppercase letters into lowercase in the string. After modification, a new string is returned with all the conversions.

The signature of toLowerCase() String is given as defined in Java API.

In the following example, toLowerCase() String is used to convert all uppercase letters to lowercase letters in string oldString. Original string oldString is not disturbed.

public class StringMethodDemo
{
 public static void main(String args[])
 {
  String oldString = "Hello World How Do You Do";

  String newString = oldString.toLowerCase();

  System.out.println("Original string before conversion: " + oldString);
  System.out.println("\nNew string after conversion: " + newString);
 }
}



Output screen of toLowerCase() String Example

Pass your comments and suggestions on this tutorial "toLowerCase() String Example".