java.lang.String codePointAt()

Description :

This java tutorial shows how to use the codePointAt() method of java.lang.String class. This method returns int data type which corresponds to the the Unicode point at specified index. This generally supports characters above the Charater.MAX_VALUE.

Method Syntax :

public int codePointAt(int index)

Parameter Input :

  • index – the index or position of the char value that we want to get.

Method Returns :

This method returns int datatype that corresponds to the code point value of the character at specified index.

Compatibility Version :

Requires Java 1.5 and up

Exception :


– The codePointAt() method of String class throws IndexOutOfBoundsException whenever the index provided on the method argument is outside the range of the String. The maximum index argument is expected to be String length -1.

Java Code Example :

This example source code demonstrates the use of codePointAt() method of String class.

Sample Output :

Running the codePointAt() example source code will give you the following output

java string codePointAt method example

java string codePointAt method example

Exception Scenario :

Suggested Reading List :