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
嗯......小编最近要考试了,太难了。鸭梨山大......祝福我吧。
这篇博客展示了简单的Java代码示例,用于获取字符串的第一个和最后一个字符。作者分享了近期面临的考试压力,暗示内容可能与学习或复习编程相关。

被折叠的 条评论
为什么被折叠?



