集册 Java实例教程 从字符串中提取子字符串

从字符串中提取子字符串

欢马劈雪     最近更新时间:2020-01-02 10:19:05

413
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
从字符串中提取子字符串
/* 
*来 自
 nowjava - 时  代  Java
*/

public class Main {

  public static void main(String[] args) {

    String s = "Baseball";

    String b = s.substring(4);

    System.out.println(b);

    s = "Baseball";

    b = s.substring(2, 6);

    System.out.println(b);

  }


}