Java Character isLetter() Method
Example
Check if characters are letters:
public class Main {
public static void main(String[] args) {
System.out.println(Character.isLetter('A'));
System.out.println(Character.isLetter('5'));
System.out.println(Character.isLetter('#'));
}
}
Definition and Usage
The isLetter() method checks if a character is a letter. It returns true for uppercase and lowercase letters, and false for digits, spaces and symbols.
It also returns true for letters from other alphabets, like Greek or Arabic letters.
Tip: Use isLetterOrDigit() to check for a letter or a digit in one call.
Syntax
One of the following:
public static boolean isLetter(char ch)
public static boolean isLetter(int codePoint)
Most programs use the first version, with a char. The second version takes the character as a code point (the number that Unicode gives each character), as an int.
Parameter Values
| Parameter | Description |
|---|---|
| ch | Required. The character to check. |
| codePoint | Required. The code point of the character to check. |
Technical Details
| Returns: | true if the character is a letter, otherwise false. |
|---|
Related Pages
❮ Character Methods