Javatpoint Logo
Javatpoint Logo

Java Character isJavaLetterOrDigit() Method

The isJavaLetterOrDigit(char ch) method of Character class determines whether the given(or specified) character can be a part of Java identifier as other than the first character.

A character is a part of Java identifier if and only if any of the following conditions is true:

  • The character is a letter.
  • The character is a currency symbol like '$'.
  • The character is a digit.
  • The character is a connecting punctuation character like '_'.
  • The character is a numeric letter.
  • The character is a combining mask.
  • The character is a non-spacing mask.
  • The isIdentifierIgnorable() method returns true for the given character.

Syntax

Parameter

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

Return Value

The isJavaLetterOrDigit(char ch)method returns a Boolean value i.e. true if the given(or specified) character is a part of Java identifier. Otherwise, the method returns false.

Example 1

Test it Now

Output:

The result for the first character is given as:true
The result for the second character is given as:true
The result for the third character is given as:true.

Example 2

Test it Now

Output:

The result for the first character is given as:true
The result for the second character is given as:true
The result for the third character is given as:true

Example 3

Test it Now

Output:

The result for the first character is given as:true
The result for the second character is given as:false
The result for the third character is given as:true
Next TopicJava Character




Please Share

facebook twitter google plus pinterest