Java Character isUpperCase() Method
Example
Check if characters are uppercase letters:
public class Main {
public static void main(String[] args) {
System.out.println(Character.isUpperCase('A'));
System.out.println(Character.isUpperCase('a'));
System.out.println(Character.isUpperCase('5'));
}
}
Definition and Usage
The isUpperCase() method checks if a character is an uppercase letter, like 'A'.
It returns false for lowercase letters, and also for characters that are not letters, like digits and spaces.
Tip: Use isLowerCase() to check for a lowercase letter.
Syntax
One of the following:
public static boolean isUpperCase(char ch)
public static boolean isUpperCase(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 an uppercase letter, otherwise false. |
|---|
Related Pages
❮ Character Methods