java.lang.Character getName(int codePoint)


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:

Character.getName(int codePoint)

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.


  • 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.


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.


 * This example source code demonstrates the use of 
 * getName(int codePoint) method of Character class.

public class CharacterGetNameCharExample {

	public static void main(String[] args) {

		// declare codepoints
		int codepoint1 = 93;
		int codepoint2 = 190;

		// get the Unicode name of the specified character codePoint
		String result1 = Character.getName(codepoint1);
		String result2 = Character.getName(codepoint2);
		// print the result
		System.out.println("character '" + (char)codepoint1 
				+ "' unicode name is " + result1);
		System.out.println("character '" + (char)codepoint2
				+ "' unicode name is " + result2);



Sample Output

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

java Character getName(int codePoint) example output