Trusted answers to developer questions

What is Character.toLowerCase in Java?

Free System Design Interview Course

Many candidates are rejected or down-leveled due to poor performance in their System Design Interview. Stand out in System Design Interviews and get hired in 2024 with this popular free course.

Overview

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.

Syntax

public static char toLowerCase(char ch)

Parameters

  • char ch: the character that needs conversion.

Return value

  • Lowercase version of the character.

Example

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

java
lowercase
characters
Did you find this helpful?