As per the API documentation for charAt, it throws IndexOutOfBoundsException if you pass an invalid value (that is, if the index argument is negative or not less than the length of this string).
Both - ArrayIndexOutOfBoundsException and StringIndexOutOfBoundsException, extend IndexOutOfBoundsException and although in practice, the charAt method throws StringIndexOutOfBoundsException, it is not a valid option because the implementation is free to throw some other exception as long as it is an IndexOutOfBoundsException.
What does it mean that the implementation is free to throw another exception, as long as it's a subclass of IndexOutOfBoundsException? Does it mean that an overriding charAt() method (created by the programmer) may throw any subclass of IndexOutOfBoundsException?
String is a final class so this method cannot be overridden. By "implementation is is free to throw another exception, as long as it's a subclass of IndexOutOfBoundsException", it means that the JDK class code would be well within its rights if decides to throw some other subclass of IndexOutOfBoundsException
The answer to this question is admittedly controversial but we have still kept it to make sure the reader is aware of the issue (charAt method is included in the objectives and there are questions in the exam on this method).