java-string-examplesStrings

How to convert a String to lowercase in Java

Posted On
Posted By admin

In this blog post, I will be explaining how you can convert a String to lowercase in Java. Consider the following code snippet:

 

</pre>
package learnjava.strings;

public class StringLowerCaseDemo {

public static void main(String[] args) {
String str = "Hello World";
str = str.toLowerCase();
System.out.println(str);

}

}
<pre>

 

There is a String.toLowerCase method. This converts the String object on which it is invoked to lowercase and returns the converted String. So when you run the above code, you will get the following output:

hello world
If you like this post, please do let me know via the comments box below.  You can also connect with me via my Facebook Page or subscribe to my Youtube channel!

Related Post

leave a Comment