Easy Tutorial
❮ Java Arraylist Isempty Java Dataoutputstream ❯

Java charAt() Method

Java String Class


The charAt() method is used to return the character at the specified index. The index range is from 0 to length() - 1.

Syntax

public char charAt(int index)

Parameters

Return Value

Returns the character at the specified index.

Example

public class Test {
    public static void main(String args[]) {
        String s = "www.tutorialpro.org";
        char result = s.charAt(6);
        System.out.println(result);
    }
}

The above program execution result is:

n

Java String Class

❮ Java Arraylist Isempty Java Dataoutputstream ❯