The toLowerCase()
method is a static method in the Character
class in Java, which is used to convert a character to lowercase. The input to this function is a character.
If you need to convert a string to lowercase, refer to the String.toLowerCase method.
public static char toLowerCase(char ch)
char ch
: the character that needs conversion.In the code below, we use the toLowerCase
function to convert different characters to lowercase.
public class Main { public static void main( String args[] ) { char ch = 'a'; System.out.println(Character.toLowerCase(ch)); ch = 'A'; System.out.println(Character.toLowerCase(ch)); ch = 'z'; System.out.println(Character.toLowerCase(ch)); ch = 'Z'; System.out.println(Character.toLowerCase(ch)); } }
RELATED TAGS
CONTRIBUTOR
View all Courses