New Tutorials:   NUMPY    TKINTER    KOTLIN    JAVASCRIPT    SASS/SCSS    PL/SQL    Matplotlib    C++ Programs

Java Character isJavaIdentifierStart(int codePoint) Method

Java isJavaIdentifierStart(int codePoint) is a part of Character class. This method is used to determine whether the specified Unicode codepoint character is the first character in a Java identifier or not.

It must be noted that this method does not handle supplementary characters.

Syntax:

public static boolean isJavaIdentifierStart(int codePoint)

Parameters:

The parameter passed is the Unicode codepoint character to be checked for Java start identifier.

Returns:

Returns the boolean value true if the specified character is a part of Java start identifier else returns false.

Example 1:

Here, the characters are checked whether they are a part of a Java start identifier or not.

public class StudyTonight
{  
	public static void main(String[] args)
	{  
		int cp1 = 48;  
		int cp2 = 61;  
		int cp3 = 119;  
		int cp4 = 90;   
		int cp5 = 1232;  

		boolean b1 = Character.isJavaIdentifierStart(cp1);  
		boolean b2 = Character.isJavaIdentifierStart(cp2);  
		boolean b3 = Character.isJavaIdentifierStart(cp3);  
		boolean b4 = Character.isJavaIdentifierStart(cp4);  
		boolean b5 = Character.isJavaIdentifierStart(cp5);  

		System.out.println((char)cp1 +" is a part of Java start identifier??:  "+b1);  
		System.out.println((char)cp2 +" is a part of Java start identifier??:  "+b2);  
		System.out.println((char)cp3 +" is a part of Java start identifier??:  "+b3);  
		System.out.println((char)cp4 +" is a part of Java start identifier??:  "+b4);  
		System.out.println((char)cp5 +" is a part of Java start identifier??:  "+b5);  
	}  
} 


0 is a part of Java start identifier??: false
= is a part of Java start identifier??: false
w is a part of Java start identifier??: true
Z is a part of Java start identifier??: true
? is a part of Java start identifier??: true

Example 2:

Here is a user-defined example where anyone using this code can put a value of his choice and get the equivalent output.

import java.util.Scanner; 
public class StudyTonight
{  
	public static void main(String[] args)
	{  
		try
		{
			System.out.print("Enter the Unicode codepoint: ");  
			Scanner sc = new Scanner(System.in);         
			int cp = sc.nextInt();  
			boolean b = Character.isJavaIdentifierStart(cp);
			System.out.println((char)cp + " is a part of Java start identifier??: "+b);
		}
		catch(Exception e)
		{
			System.out.println("Invalid Input!!");
		}
	}  
}


Enter the Unicode codepoint: 77
M is a part of Java start identifier??: true
***********************************************
Enter the Unicode codepoint: 43
+ is a part of Java start identifier??: false

Live Example:

Here, you can test the live code example. You can execute the example for different values, even can edit and write your examples to test the Java code.