Javatpoint Logo
Javatpoint Logo

Java Character isLetter() Method

The isLetter(char ch) method of Character class determines whether the given(or specified) character is a letter or not.

A character is considered to be a letter if the general category type provided by the Character.getType(ch) is one of the following:

  • UPPERCASE_LETTER.
  • LOWERCASE_LETTER.
  • TITLECASE_LETTER.
  • MODIFIER_LETTER.
  • OTHER_LETTER

Syntax

Parameter

ch: It is the character that needs to be tested.

Return Value

The isLetter(char ch) method returns a Boolean value i.e. true if the given(or specified) character is a letter. Otherwise, the method returns false.

Example 1

Test it Now

Output:

The character A is a letter: true
The character 9 is a letter: false
The character e is a letter: true

Example 2

Test it Now

Output:

The character 1 is a letter: false
The character * is a letter: false
The character e is a letter: true

Example 3

Test it Now

Output:

The character 1 is a letter: false
The character ) is a letter: false
The character * is a letter: false

Java Character isLetter(int codePoint) Method

The isLetter(int codePoint) method of character class determines whether the given(or specified) character is a letter or not.

A character is considered to be a letter if the general category type provided by the Character.getType(codePoint) is one of the following:

  • UPPERCASE_LETTER.
  • LOWERCASE_LETTER.
  • TITLECASE_LETTER.
  • MODIFIER_LETTER.
  • OTHER_LETTER

Syntax

Parameter

The above method requires only one parameter:

a.)The codePoint which is the character that needs to be tested.

Return Value

The isLetter(int codePoint)method returns a boolean value i.e. true, if the given(or specified) character is a letter. Otherwise, the method returns false.

Example 4

Test it Now

Output:

The first codePoint  56 is a letter: false
The second codePoint 110 is a letter: true
The third codePoint  123 is a letter: false
The fourth codePoint 315 is a letter: false

Example 5

Output:

Enter the first input:8
The character '8' is not a letter.
Enter the second input:T
The character 'T' is a letter. 
Enter the third input:&
The character '&' is a letter. 
Next TopicJava Character




Help Others, Please Share

facebook twitter pinterest