The charAt() method returns the character at the specified index, the Index range from 0 to length() -1.
Signature
The signature or syntax of string charAt() method is given below:
1 2 3 4 |
/** @param index the character index of the input string */ public char charAt(int index) |
Return the character at the specified index.
Example
1 2 3 4 5 6 7 |
public class Test { public static void main(String args[]) { String s = "www.asenview.com"; char result = s.charAt(6); System.out.println(result); } } |
The output is
1 |
s |