String.codePointAt(int index) has the following syntax.
public int codePointAt(int index)
In the following code shows how to use String.codePointAt(int index) method.
public class Main { //from ww w.ja va 2 s. c om public static void main(String[] args) { String str = "java2s.com"; System.out.println("String = " + str); // codepoint at index 1 int retval = str.codePointAt(1); // prints character at index1 in string System.out.println("Character(unicode point) = " + retval); } }
The code above generates the following result.