Home » Java programming language

Java String toLowerCase() Method with Example

Java String toLowerCase() Method: Here, we are going to learn about the toLowerCase() method with example in Java.
Submitted by IncludeHelp, on February 08, 2019

String toLowerCase() Method

toLowerCase() method is a String class method, it is used to convert given string into the lowercase.

Syntax:

    String String_object.toLowerCase();

Here, String_object is a String object which we have to convert into lowercase. The method does not change the string; it returns the lowercase converted string.

Example:

    Input:
    str = "Welcome at IncludeHelp!"
    Function call:
    ans = str.toLowerCase()

    Output:
    ans = "welcome at includehelp!"

Code:

public class Main
{
    public static void main(String[] args) {
		String str = "Welcome at IncludeHelp!";
		String ans = str.toLowerCase();
		System.out.println("str = " + str);
		System.out.println("ans = " + ans);		
    }
}

Output

str = Welcome at IncludeHelp!
ans = welcome at includehelp!


Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.