Signup/Sign In
LAST UPDATED: NOVEMBER 24, 2020

Java Character isIdeographic() Method

Java isIdeographic() method is a part of Character class. This method is used to check whether the specified Unicode codepoint character is CJKV (Chinese, Japanese, Korean, and Vietnamese) ideograph, as defined by the Unicode Standard or not.

Syntax:

public static boolean isIdeographic(int codePoint)

Parameters:

The parameter passed is the Unicode codepoint character to be checked.

Returns:

Returns the boolean value true if the specified character is CJKV ideograph, else return false.

Example 1:

Here, the characters are checked whether they are CJKV ideograph or not.

public class StudyTonight
{  
	public static void main(String[] args)
	{  
		int cp1 = 13477;  
		int cp2 = 12712;  
		int cp3 = 50;  
		int cp4 = 83453;   
		int cp5 = -55;  

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

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


? is a CJKV ideograph?: true
? is a CJKV ideograph?: false
2 is a CJKV ideograph?: false
? is a CJKV ideograph? : false
? is a CJKV ideograph?: false

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 codepoint: ");  
			Scanner sc = new Scanner(System.in);         
			int cp = sc.nextInt();  
			boolean b = Character.isIdeographic(cp);
			System.out.println((char)cp + " is a CJKV ideograph?? : "+b);
		}
		catch(Exception e)
		{
			System.out.println("Invalid Input!!");
		}
	}  
}  


Enter the codepoint: 12139
? is a CJKV ideograph?? : false
*************************************
Enter the codepoint: 13772
? is a CJKV ideograph?? : 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.



About the author:
A Computer Science and Engineering Graduate(2016-2020) from JSSATE Noida. JAVA is Love. Sincerely Followed Sachin Tendulkar as a child, M S Dhoni as a teenager, and Virat Kohli as an adult.