Retrieve the character at the initial position (0) of the string.
String |
The charAt() method retrieves the character positioned at the specified index within a string.
The index of the first character is 0, the second character is 1, and so on.
|
Parameter |
Description |
index |
An integer value indicating the index of the character to be returned. |
Returns: |
A character value located at the specified index within this string. The initial character is situated at index 0. |
Throws: |
IndexOutOfBoundsException occurs if the index is negative or exceeds the length of the specified string. |