You can grab a single character from a string using .charAt(index). Indexes start at , just like arrays.
String word = "Hello";
char first = word.charAt(0);
char last = word.charAt(4);
System.out.println(first);
System.out.println(last);
This prints H and then o. The character at index is the first character. The character at index is the fifth and last character.
If you pass an index that is negative or equal to or greater than the string's length, Java throws a StringIndexOutOfBoundsException. To safely get the last character, use word.charAt(word.length() - 1). This pattern works for any string length as long as the string is not empty.