面向对象15.3String类-常见功能-获取-2

public class String_APImethod {
/*
* 1.4获取字符串中的一部分字符串,也叫字符串
* String substring(int beginIndex, int endIndex)返回一个新字符串,它是此字符串的一个子字符串。
* 包含begin,不包含end
* String substring(int beginIndex)返回一个新的字符串,它是此字符串的一个子字符串。
*
*
* */
public static void main(String[] args) {
String s="abcdae";
System.out.println(s.substring(4));//e
System.out.println(s.substring(1, 3));//bc
}
}

原文地址:https://www.cnblogs.com/likeji/p/6218896.html