Trusted answers to developer questions

What is String.toLowerCase() in Java?

Get Started With Machine Learning

Learn the fundamentals of Machine Learning with this free course. Future-proof your career by adding ML skills to your toolkit — or prepare to land a job in AI or Data Science.

The toLowerCase() function converts a string to lowercase.

The following figure shows a visual representation of the toLowerCase() function.

Visual representation of toLowerCase() function

Syntax

String toLowerCase()

// Usage
string_1.toLowercase()

Parameter

The toLowerCase() function does not require a parameter.

Return value

The toLowerCase() function returns a string that is converted to lowercase.

Code

class JAVA {
public static void main( String args[] ) {
String string="EDUCATIVE";
String string_1="eDUCATIVE09";
//to lowercase string
System.out.println("string.toLowerCase():");
System.out.println(string.toLowerCase());
//to lowercase string and number
System.out.println("string_1.toLowerCase():");
System.out.println(string_1.toLowerCase());
}
}

RELATED TAGS

java
Did you find this helpful?