The .toLowerCase() method converts all the characters of a string to lowercase characters in Java.

Note: This method is locale sensitive, in consequence it might produce unexpected results because it takes into account the user’s locale, particularly when the string represents locale-specific values, e.g. date or time.



Where upperCaseString is the string with some or all upper case characters to be converted.


This example converts uppercase characters to lowercase characters:

// Example.java
public class Example {
public static void main(String[] args){
String S1 = new String("ThiS IS an EXAMple");

This outputs the following:

this is an example


Interested in helping build Docs? Read the Contribution Guide or share your thoughts in this feedback form.

Learn Java on Codecademy