Copyright © tutorialspoint.com
This method returns the character located at the String's specified index. The string indexes start from zero.
Here is the syntax of this method:
public char charAt(int index) |
Here is the detail of parameters:
index : Index of the character to be returned.
Returns a char at the specified index.
public class Test{ public static void main(String args[]){ String s = "Strings are immutable"; char result = s.charAt(8); System.out.println(result); } } |
This produces following result:
a |
Copyright © tutorialspoint.com