public class CharacterIndex{
public static void main(String args[]){
String s = "And sometimes we feel like we're changing ourselves";
char sStart = s.charAt(0);
char sEnd = s.charAt(s.length()-1);
System.out.println(sStart);
System.out.println(sEnd);
}
}
测试结果:
A
s
嗯......小编最近要考试了,太难了。鸭梨山大......祝福我吧。