[ Web Proxy ]
URL:
Viewing: https://www.tutorialspoint.com/java/java_string_charat.htm [Back]  [Original]

Java - String charAt() Method
Tutorials Courses Jobs Login
Selected Reading
Home Java Java - String charAt() Method

Java - String charAt() Method



Description

This method returns the character located at the String's specified index. The string indexes start from zero.

Syntax

Here is the syntax of this method

public char charAt(int index)

Parameters

Here is the detail of parameters

  • index Index of the character to be returned.

Return Value

  • This method returns a char at the specified index.

Example

public class Test {

   public static void main(String args[]) {
      String s = "Strings are immutable";
      char result = s.charAt(8);
      System.out.println(result);
   }
}

This will produce the following result

Output

a
java_strings.htm
Tutorix - AI Tutor [Tutorix - AI Tutor]
Print Page
Advertisements

Web Proxy Viewer  |  New URL  |  Original Page