java.lang.String.charAt()方法 返回 指定索引 处的 char值。索引范围 是从0 到length() - 1。
public char charAt(int index) { if ((index < 0) || (index >= value.length)) { throw new StringIndexOutOfBoundsException(index); } return value[index]; }String s = "We are happy.";System.out.println(s.charAt(1));//e