1.substring() 方法返回字符串的子字符串。
public String substring(int beginIndex)
或
public String substring(int beginIndex, int endIndex)
1 class Main { 2 public static void main(String[] args) { 3 String str = new String("this my practice"); 4 System.out.print("返回值:"); 5 System.out.println(str.substring(4)); 6 System.out.print("返回值:"); 7 System.out.println(str.substring(4,8)); 8 } 9 }
标签:Java,String,int,System,substring,public,out From: https://www.cnblogs.com/messing1758954258/p/17768403.html