Home »
Java programming language
Java - Character Class toLowerCase() Method
Character class toLowerCase() method: Here, we are going to learn about the toLowerCase() method of Character class with its syntax and example.
By Preeti Jain Last updated : March 17, 2024
Character class toLowerCase() method
- toLowerCase() method is available in java.lang package.
- toLowerCase() method is used to return the lowercase character of the given char value.
- toLowerCase() method does not throw an exception at the time of representing uppercase character to lowercase character or lowercase to the lowercase character.
Syntax
public char toLowerCase (Char value);
Parameters
- Char value – represents the char value to be converted.
Return Value
The return type of this method is char, it returns the lowercase conversion of the given char value.
Example
// Java program to demonstrate the example
// of char toLowerCase (Char value) method of Character class
public class ToLowerCaseOfCharacterClass {
public static void main(String[] args) {
// It returns p because the passing character will
// be converted in LowerCase by using toLowerCase()
char result1 = Character.toLowerCase('P');
// It returns p because the passing character is
// already in LowerCase
char result2 = Character.toLowerCase('p');
// Display values of result1 , result2
System.out.println("Character.toLowerCase('P'): " + result1);
System.out.println("Character.toLowerCase('p'): " + result2);
}
}
Output
Character.toLowerCase('P'): p
Character.toLowerCase('p'): p