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

Java Character isDefined(int codepoint) Method

Java isDefined(int codepoint) method is a part of Character class. This method is used to check whether the specified Unicode codepoint character is defined in Unicode or not. For a codepoint character to be defined in Unicode, a character must satisfy either of the two(or both) conditions:

  • The Character must have an entry in the UnicodeData file.
  • The value of Character is in a range defined by the UnicodeData file.


public static boolean isDefined(int codePoint)  


The parameter passed is the Unicode codepoint character value to be checked whether it is defined in Unicode or not.


Returns the boolean value true if the specified codepoint character is defined in Unicode else return false.

Example 1:

Here, the characters are checked by using the isDefined() method whether they are defined in Unicode or not.

public class StudyTonight
	public static void main(String[] args)
		int cp1 = 66;  
		int cp2 = 78;  
		int cp3 = 101;  
		int cp4 = 90;   
		int cp5 = 121;  

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

		System.out.println((char)cp1 +" is defined?? :  "+b1);  
		System.out.println((char)cp2 +" is defined?? :  "+b2);   
		System.out.println((char)cp3 +" is defined?? :  "+b3);   
		System.out.println((char)cp4 +" is defined?? :  "+b4);   
		System.out.println((char)cp5 +" is defined?? :  "+b5);   

B is defined?? : true
N is defined?? : true
e is defined?? : true
Z is defined?? : true
y is defined?? : 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)
			System.out.print("Enter the unicode codepoint value: ");  
			Scanner sc = new Scanner(;         
			int cp = sc.nextInt();  
			boolean b = Character.isDefined(cp);
			System.out.println((char)cp + " is defined?? : "+b);
		catch(Exception e)
			System.out.println("Invalid Input!!");

Enter the unicode codepoint value: 88
X is defined?? : true
Enter the unicode codepoint value: 121
y is defined?? : true

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.