This process returns the quality placed at the String's precise index. The string indexes create from zero. The java string charAt() way returns a char significance at the agreed index number. The index number begins from 0 and goes to n-1, where n is the length of the thread. It returns StringIndexOutOfBoundsException if the known index number is better than or equivalent to this string span or a negative number.
Here is the syntax of this method:
public char charAt(int index)
Here is the detail of parameters −
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:
a
Here at Intellinuts, we have created a complete Java tutorial for Beginners to get started in Java.