In this tutorial, you will learn about String toLowerCase() method, its syntax, and usage with examples.

Java String toLowerCase() method

In Java, String toLowerCase() method converts all the characters in the string to lower case.

Test input string

Hello World

Lower case string

hello world

Syntax of toLowerCase()

The syntax to call String toLowerCase() method in Java is

string.toLowerCase()

toLowerCase() method takes no parameters.

toLowerCase() returns value of String type.

ADVERTISEMENT

Examples

1. toLowerCase() – Convert the string “Hello World” to lower case in Java

In this example, we take a string value of "Hello World" in str, and convert this string to lower case using String toLowerCase() method.

Java Program

public class Main {
	public static void main(String[] args) {
		String str = "Hello World";
		String lowerCaseStr = str.toLowerCase();
		System.out.println("Given string     : " + str);
		System.out.println("Lowercase string : " + lowerCaseStr);
	}
}

Output

Given string     : Hello World
Lowercase string : hello world

Conclusion

In this Java String Methods tutorial, we have seen about String toLowerCase() method in Java, its syntax, and how to use String toLowerCase() method in Java programs with the help of examples.