Javatpoint Logo
Javatpoint Logo

Java Character isJavaIdentifierstart() Method

The isJavaIdentifierStart(char ch) method of Character class determines whether the given(or specified) character is considered as the first character in a Java identifier or not.

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

  • isLetter(ch) returns true.
  • getType(ch) returns LETTER_NUMBER.
  • The character ch is a currency symbol.
  • The character ch is a connecting punctuation character such as '_'.

Note: The above method cannot be used to handle supplementary characters. In order to support all the Unicode characters, including all the supplementary character, we can use the isJavaIdentifierStart(int) method.

Syntax

Parameter

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

Return Value

The isJavaIdentifierStart(char ch) method returns a Boolean value i.e. true if the given(or specified) character may start a particular Java identifier. Otherwise, the method returns false.

Example 1

Test it Now

Output:

The first character may start a Java identifier: false
 The second character may start a Java identifier: false
 The third character may start a Java identifier: true

Example 2

Test it Now

Output:

The first character may start a Java identifier: true
The second character may start a Java identifier: true
The third character may start a Java identifier: true

Example 3

Output:

Enter the first character:)
The first input ')' may not start a Java identifier.
Enter the second character:k
The second input 'k' may not start a Java identifier.
Next TopicJava Character




Help Others, Please Share

facebook twitter pinterest