Convert String To Lowercase Example Java Program


Definition

A string is traditionally a sequence of characters, either as a literal constant or as some kind of variable. A string is generally understood as a data type and is often implemented as an array of bytes (or words) that stores a sequence of elements, typically characters, using some character encoding. The case of a particular string can be found using inbuilt methods. These methods checks the case of each character in the string.

Syntax

String_Variable_Name.toLowercase();

Convert String To Lowercase Example Program

class ConvertToLowercase {
	public static void main(String[] args) {
		String str = "sHe SELLs Sea SHElls on ThE SEa ShORe";
		String strLower = str.toLowerCase();
		System.out.println("input: " + str);
		System.out.println("output: " + strLower);
	}
}

Sample Output

Output is:
input: sHe SELLs Sea SHElls on ThE SEa ShORe
output: she  sells  sea  shells on  the  sea  shore