Write a program to convert all the characters in a string to Lowercase


This Java program converts a given String to lowercase using the toLowerCase() method and prints the resulting lowercase String.

The program defines a public class named "LowerCase" with a main method that takes no arguments. The main method declares a String variable str with the value "Tutor Joes Computer Education".

Then, the program uses the toLowerCase() method of the String class to convert str to lowercase and stores the result in the String variable lwr_str.

Finally, the program prints out the original String str and the resulting lowercase String lwr_str using the System.out.println method.

Source Code

public class LowerCase
{
	public static void main(String[] args)
	{
		String str = "Tutor Joes Computer Education";
		String lwr_str = str.toLowerCase();
		System.out.println("Given String : " + str);
		System.out.println("String in Lowercase : " + lwr_str);
	}
}

Output

Given String : Tutor Joes Computer Education
String in Lowercase : tutor joes computer education

Example Programs