Java String codePointAt() Method

You are Here:

Java String codePointAt()

The codePointAt() method returns the Unicode value of the character at the given index in a string.

The index number starts from 0 and goes to n-1, where n is length of the string.

Example

Java Compiler
public class myClass { public static void main(String[] args) { String str = "Apple"; System.out.print(str.codePointAt(0)); // 65 } }

Output

65

Syntax

public int codePointAt(int index)

Parameter Values

ValueTypeExplanation
indexRequiredSpecifies an index number.

Return Value

ValueExplanation
NumberReturns the Unicode value of the character at the given index in a string.
ErrorReturns StringIndexOutOfBoundsException, if index number is negative or not less than the length of the given string.

Reminder

Hi Developers, we almost covered 90% of String functions and Interview Question on Java with examples for quick and easy learning.

We are working to cover every Single Concept in Java.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author