Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

java
lowercase
characters
communitycreator

What is Character.toLowerCase in Java?

abhilash

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
communitycreator
RELATED COURSES

View all Courses

Keep Exploring