Site icon TestingDocs.com

Java toLowerCase() method

Java toLowerCase() method

The Java toLowerCase() method returns the string in lowercase letters. In other words, it converts all string characters into lowercase letters.

Example

Let’s understand the method with the help of a program:

package com.testingdocs.stringmethods;

public class ExampleProgram {

	public static void main(String[] args) {

		String str= "This is a SAMPLE Sentence Example.";
		
		// toLowerCase() method demo
		System.out.println("Before           : " + str);
		System.out.println("After toLowerCase: " + str.toLowerCase());
	}
}

Program Output

The sample Java program produces the following output as shown below:

Before : This is a SAMPLE Sentence Example.

After toLowerCase: this is a sample sentence example.

 

Java Tutorials

Java Tutorial on this website:

For more information on Java, visit the official website :

Exit mobile version