var str = 'yejiang'; str.charAt(str.length-1);
String str = "yejiang"; System.out.println(str.charAt(str.length() -1));
小结:用字符串的charAt(),传入字符串长度减一。