JAVA program to convert a string from uppercase to lowercase using string method toLowerCase() 

JAVA program to convert a string from uppercase to lowercase using string method toLowerCase()

This JAVA program is to convert a string from uppercase to lowercase using string method toLowerCase().

toLowerCase() method converts the string to lower case.

For example, if the given string is “CODE”(uppercase) then the string will be converted to “code”(lowercase).

Dry Run of the Program

Take input string ‘str’.Let us take str = CODE

str = str.toLowerCase()

So the output printed is ‘code’.

Program

import java.util.*;

class upLower
{
	public static void main(String args[])
	{
		Scanner sc = new Scanner(System.in);
		System.out.println("Enter the string to be converted to LowerCase");
		String str = sc.nextLine();

		str = str.toLowerCase();  //converts string to lowercase
		System.out.println("String on using toLowerCase() method = "+str);
	}
}

Output

Share Me!