In Java, string positions are indexed starting from 0. This means that the first character of a string is at index 0, the second character is at index 1, and so on. For example, in the string "Hello":
His at index 0eis at index 1lis at index 2lis at index 3ois at index 4
You can access a character in a string using the charAt() method. For example:
String str = "Hello";
char firstChar = str.charAt(0); // 'H'
char secondChar = str.charAt(1); // 'e'
If you try to access an index that is out of bounds (less than 0 or greater than or equal to the string length), it will throw a StringIndexOutOfBoundsException.
