Character.isJavaIdentifierStart(): This method is available in java.lang.Character class of Java.
Approach 1: When the argument of type char.
Syntax:
boolean java.lang.Character.isJavaIdentifierStart(char ch)
This method takes one argument of type char as its parameter. This method determines if the specified character is permissible as the first character in a Java identifier.
Note:
1. ch is a currency symbol (such as '$').
2. ch is a connecting punctuation character (such as '_').
Parameters: One parameter is required for this method.
ch: the character to be tested.
Returns: true if the character may start a Java identifier; false otherwise.
Exceptions: NA
Java
public class CharacterisJavaIdentifierStartchar {public static void main(String[] args) {char ch = 'a';System.out.println(Character.isJavaIdentifierStart(ch));}}
Output:
true
Approach 2: When the argument of type int.
Syntax:
boolean java.lang.Character.isJavaIdentifierStart(int codePoint)
This method takes one argument of type int as its parameter. This method determines if the character (Unicode code point) is permissible as the first character in a Java identifier.
Note:
1. The referenced character is a currency symbol (such as '$').
2. The referenced character is a connecting punctuation character(such as '_').
Parameters: codePoint the character (Unicode code point) to be tested.
Returns: true if the character may start a Java identifier; false otherwise.
Exceptions: NA
Java
public class CharacterisJavaIdentifierStartint {public static void main(String[] args) {int codePoint = '_';System.out.println(Character.isJavaIdentifierStart(codePoint));}}
Output:
No comments:
Post a Comment