Java.lang.Character.isDefined() Method
Advertisements
Description
The java.lang.Character.isDefined(char ch) determines if a character is defined in Unicode.
A character is defined if at least one of the following is true:
It has an entry in the UnicodeData file.
It has a value in a range defined by the UnicodeData file.
Declaration
Following is the declaration for java.lang.Character.isDefined() method
public static boolean isDefined(char ch)
Parameters
ch - the character to be tested
Return Value
This method returns true if the character has a defined meaning in Unicode, false otherwise.
Exception
NA
Example
The following example shows the usage of lang.Character.isDefined() method.
package com.tutorialspoint;
import java.lang.*;
public class CharacterDemo {
public static void main(String[] args) {
// create a char primitive ch
char ch;
// assign value to ch
ch = '@';
// create a boolean primitives b
boolean b;
// assign isDefined result of ch to b
b = Character.isDefined(ch);
String str = "Character " +ch+ " has defined meaning in Unicode is " +b;
// print b value
System.out.println( str );
}
}
Let us compile and run the above program, this will produce the following result:
Character @ has defined meaning in Unicode is true