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());
    }
}

 

posted @ 2016-11-04 10:57  FrankYou  阅读(1100)  评论(0编辑  收藏  举报