Java String codePointAt() Method Tutorial

In this section, we will learn what the String codePointAt() method is and how to use it in Java.

What is Java String codePointAt() Method?

The codePointAt() method is used to get the Unicode of a character at the specified index in a String value.

Java codePointAt() Method Syntax:

public int codePointAt(int index)

codePointAt() Method Parameters:

The method basically takes one argument, and that is the index number of the target character in a string that we want to have its Unicode number.

codePointAt() Method Return Value:

The return value of this method is an integer value, which is the Unicode number of the target character.

codePointAt() Method Exceptions:

  • The value we set as the argument of the method should be in the length’s range of the target String. Otherwise we will get the StringIndexOutOfBoundsException exception.
  • The first element of a string is at index 0 and the last one is at index (length-1). So make sure the number is in the range.

Example: using String codePointAt() method

public class Simple {

    public static void main(String[] args) {
        String s = "Hello";
        int unicode = s.codePointAt(0);


Top Technologies