Javatpoint Logo
Javatpoint Logo

Java Character isJavaIdentifierPart() Method

The isJavaIdentifierPart(char ch) method of character class determines whether the given (or specified) character is a part of Java identifier or not.

The given character is a part of a Java identifier if any of the following condition is true:

  • The character is a letter.
  • The character is a currency symbol(such as '$').
  • The character is a connecting punctuation character(such as '_').
  • The character is a digit.
  • The character is a numeric letter(such as a Roman numeral character).
  • The character is a combining mark.
  • The character is non spacing mark.
  • The isIdentifierIgnorable() method returns true for the specific character.

Syntax

Parameter

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

Return Value

The isJavaIdentifierPart(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

Output:

Enter the first input:&
The character '&' is not a part of Java Identifier.
Enter the second input:A
The character 'A' is a part of Java Identifier.

Example 2

Test it Now

Output:

The first character is a part of java identifier:  false
The second character is a part of java identifier: true
The third character is a part of java identifier:  true

Java Character isJavaIdentifierPart() Method

The isJavaIdentifierPart(int codePoint) method of Character class determines whether the given(or specified) character is a part of Java identifier or not.

The given character is a part of a Java identifier if any of the following condition is true:

  • The character is a letter.
  • The character is a currency symbol(such as '$').
  • The character is a connecting punctuation character(such as '_').
  • The character is a digit.
  • The character is a numeric letter(such as a Roman numeral character).
  • The character is a combining mark.
  • The character is non-spacing mark.
  • The isIdentifierIgnorable() method returns true for the specific character.

Syntax

Parameter

codePoint: It is the codePoint which is the character that needs to be tested.

Return Value

The isJavaIdentifierPart(int codePoint) method returns a boolean value true if the given(or specified) character is a part of Java identifier. Otherwise, the method returns false.

Example 3

Test it Now

Output:

The first codepoint '89' is a part of Java identifier.
The second codepoint '90' is a part of Java identifier.
The third codepoint '110' is a part of Java identifier.

Example 4

Test it Now

Output:

The boolean value for the first codePoint is given as: true
The boolean value for the second codePoint is given as: true
The boolean value for the third codePoint is given as: true

Example 5

Test it Now

Output:

The boolean value for the first codePoint 'A' is given as: true
The boolean value for the second codePoint 'G' is given as: true
The boolean value for the third codePoint 'k' is given as: true
Next TopicJava Character




Help Others, Please Share

facebook twitter pinterest