public class Test { public static void main(String[] args) { String str = new String(new char[]{'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd'}); System.out.println(str.charAt(str.length() - 1 )); } } I don’t understand why it gives out d, if we assume the length is 11. And we make 11 - 1 = 10 and why it gives out d.
0, not from1. - Drakonoved Nov.