Java的整个字符串的结束索引在最后一个字符之外

/**
* Created by xfyou on 2016/11/4.
*/
public class SubstringDemo {
public static void main(String[] args) {
String a = "Java is great.";
System.out.println(a);
System.out.println(a.substring(5));
System.out.println(a.substring(5, 7)); // Java的整个字符串的结束索引在最后一个字符之外
System.out.println(a.substring(5, a.length())); System.out.println(a.indexOf('.'));
System.out.println(a.length());
}
}
上一篇:Android 电池电量进度条,上下滚动图片的进度条(battery)


下一篇:PAT-乙级-1037. 在霍格沃茨找零钱(20)