方法:substring();
注意:取到start,前闭后开
greeting = "Hello";
String greetingSubstringstartIndex = greeting.substring(1);//[1...
System.out.println("greetingSubstringstartIndex: "+greetingSubstringstartIndex);
String greetingSubstringstartIndexandendIndex = greeting.substring(2,4);//[2,4)
System.out.println("greetingSubstringstartIndexandendIndex: "+greetingSubstringstartIndexandendIndex);
运行结果: