The index number starts from 0 and goes to n-1, where n is the length of the string. The index value can't be a negative, greater than or equal to the length of the string.
The charAt() method is represented by the following syntax:
index - It represent the position of a character.
A char value
Let's see some examples of charAt() method.
Let's see a simple example to print a character.Test it Now
In this example, we will not pass an index value.Test it Now
In this example, we will print the last character.Test it Now