Java String.charAt(int index) example

By Yashwant Chavan, Views 42, Last updated on 02-Apr-2019

In this java tutorial, You will learn how to use String.charAt(int index) method. This method, Returns the char value at the specified index. An index ranges from 0 to length() - 1.

tags Java

Returns the char value at the specified index.


public char charAt(int index)


index - the index of the char value.


The char value at the specified index of this string. The first char value is at index 0.


IndexOutOfBoundsException - if the index argument is negative or not less than the length of this string.

Java String charAt(int index) example

  • Assign String value.
  • value.charAt(9);It will return the char value of the index 9 of string firstValue.
  • Print the value.
package com.technicalkeeda;

public class App {

    public static void main(String[] args) {

        String value = "Technicalkeeda";

        char result = value.charAt(9);

        System.out.println("Char value at index 9 :- " + result);


Char value at index 9 :- k

Suggested Posts



Hi there! I am founder of and programming enthusiast. My skills includes Java,J2EE, Spring Framework, Nodejs, PHP and lot more. If you have any idea that you would want me to develop? Lets connect: yashwantchavan[at][]