String toLowerCase example

String toLowerCase method is used to converts all characters in a given string to lower case. String has 2 toLowerCase methods.

The first method takes a default Locale for converting the String to lower case, while in the second method we can explicitly give a Locale for the String to convert to lower case.
Lets see an example that covers both these methods.

String toLowerCase example

Output

Please Note:
Before performing any operation on any dynamically generated String, check if the String is not null.
Else a NullPointerException is thrown.

Reference

1. String toLowerCase()- API

2. String toLowerCase(java.util.Locale)-API