Home >>Java String Methods >Java String codePointAt() Method

Java String codePointAt() Method

Java String codePointAt() Method

The codePointAt() method in Java String is used to returns the character's unicode value in a string at the specified index(first character is 0, the second character is 1, and so on).


public int codePointAt(int index)


index - It is used to representing An int value in the index of the character to return


It is representing an int value to the Unicode value of the character at the index


IndexOutOfBoundsException- Where index is negative, or not less than the specified string length

Java String codePointAt() method example 1

public class MyClass 
  public static void main(String[] args) 
    String name = " phptpoint";
    int result = name.codePointAt(0);