Last Updated : 06 Dec, 2018
The
Character.isJavaIdentifierStart(int codePoint)is an inbuilt method in java that determines if the character (Unicode code point) is permissible as the first character in a Java identifier. It is to be noted that a character may start a Java identifier if and only if one of the following conditions is true:
public static boolean isJavaIdentifierStart(int codePoint)Parameters:
The parameter
codePointis of the integer type and refers to the character (Unicode code point) that is to be tested.
Return value:The isJavaIdentifierStart(int codePoint) method of Character class returns true if the character may start a Java identifier; false otherwise. Below programs illustrate the Character.isJavaIdentifierStart() method:
Program 1: Java
// Java program to illustrate
// Character.isJavaIdentifierStart() method
import java.lang.*;
public class gfg {
public static void main(String[] args)
{
// Create 2 int primitives c1, c2
int c1 = 0x0039, c2 = 0x004b, c3 = 0x0081;
// Assign isJavaIdentifierPart results of
// c1, c2 to boolean primitives bool1, bool2
boolean bool1 = Character.isJavaIdentifierStart(c1);
boolean bool2 = Character.isJavaIdentifierStart(c2);
boolean bool3 = Character.isJavaIdentifierStart(c3);
String str1 = "c1 may start a Java identifier is " + bool1;
String str2 = "c2 may start a Java identifier is " + bool2;
String str3 = "c3 may start a Java identifier is " + bool3;
// Print bool1, bool2 values
System.out.println(str1);
System.out.println(str2);
System.out.println(str3);
}
}
Output:
c1 may start a Java identifier is false c2 may start a Java identifier is true c3 may start a Java identifier is falseProgram 2: Java
// Java program to illustrate
// Character.isJavaIdentifierStart() method
import java.lang.*;
public class gfg {
public static void main(String[] args)
{
// Create 2 int primitives c1, c2
int c1 = 0x0034, c2 = 0x005a;
// Assign isJavaIdentifierPart results of
// c1, c2 to boolean primitives bool1, bool2
boolean bool1 = Character.isJavaIdentifierStart(c1);
boolean bool2 = Character.isJavaIdentifierStart(c2);
String str1 = "c1 may start a Java identifier is " + bool1;
String str2 = "c2 may start a Java identifier is " + bool2;
// Print bool1, bool2 values
System.out.println(str1);
System.out.println(str2);
}
}
Output:
c1 may start a Java identifier is false c2 may start a Java identifier is trueReference
:
https://docs.oracle.com/javase/7/docs/api/java/lang/Character.html#isJavaIdentifierStart(char)RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4