此方法有两个变体,并返回一个新字符串,该字符串是该字符串的子字符串。子字符串以指定索引处的字符开头,并延伸到该字符串的末尾,或者直到endIndex – 1(如果提供了第二个参数)。
import java.io.*;
public class Test {
public static void main(String args[]) {
String Str = new String("Welcome to Nhooo.com");
System.out.print("返回值:" );
System.out.println(Str.substring(10) );
}
}输出结果
返回值: Nhooo.com