Java String codePointAt() method example

HQ » Java Tutorial » java.lang » String » codePointAt() method example
Java String codePointAt() method example 2018-02-19T12:37:10+00:00

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 :


Contact Info


Our Goal

JavaTutorialHQ aims to to be The Ultimate Guide on Java with hundreds of examples from basic to advance Topics.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.