Javatpoint Logo
Javatpoint Logo

Java Character isDefined() Method

The isDefined(char ch) method of Character class generally determines whether the character is defined in the Unicode or not.

A character is defined in Unicode if and only if any of the two conditions are satisfied(or true):

  • The character must have an entry made in the UnicodeData file.
  • The character must have a range which is defined by the UnicodeData file.

Syntax

Parameter

The above method requires only one parameter:

a.) The character that needs to be tested.

Return Value

The isDefined(char ch) method returns a Boolean value i.e. true, if the given(or specified) character is given with a defined meaning in the Unicode. Otherwise, it returns false.

Example 1

Test it Now

Output:

The meaning for the character @ is defined as:  true
The meaning for the character * is defined as:  true
The meaning for the character & is defined as:  true

Example 2

Test it Now

Output:

Enter a character:   $
The user input '$' is defined in the Unicode
Enter the second character:   )
The user input ')' is defined in the Unicode

Example 3

Test it Now

Output:

1 is defined in the Unicode character set: true
2 is defined in the Unicode character set: true
3 is defined in the Unicode character set: true
4 is defined in the Unicode character set: true
5 is defined in the Unicode character set: true
Next TopicJava Character



Please Share

facebook twitter google plus pinterest