java.lang.Character getName(int codePoint)

Description

The Character.getName(int codePoint) java method returns the Unicode name of the specified character codePoint, or null if the code point is unassigned.

If the specified character is not assigned a name by the UnicodeData file (part of the Unicode Character Database maintained by the Unicode Consortium), the returned name is the same as the result of expression.

The getName(int codePoint) method of Character class is static thus it should be accessed statically which means the we would be calling this method in this format:

Non static method is usually called by just declaring method_name(argument) however in this case since the method is static, it should be called by appending the class name as suffix. We will be encountering a compilation problem if we call the java getName() method non statically.

Notes:

  • This method will throw IllegalArgumentException – if the specified codePoint is not a valid Unicode code point.

Method Syntax

public static String getName(int codePoint)

Method Argument

Data Type Parameter Description
int codepoint the character (Unicode code point)

Method Returns

The getName(int codePoint) method of Character class returns a String which denotes the Unicode name of the specified character, or null if the code point is unassigned.

Compatibility

Requires Java 1.7 and up

Java Character getName(int codePoint) Example

Below is a simple java example on the usage of getName(int codePoint) method of Character class.

Sample Output

Below is the sample output when you run the above example.

java Character getName(int codePoint) example output