字符串2:
1、截取子字符串
1)取从第三个字符开始到最后
2)取第二到第四个字符
2、分割字符串
public class Day10 {
public static void main(String[] args){
//字符串2:
//1、截取子字符串
//1)取从第三个字符开始到最后 注意index是2
//参考 http://c.biancheng.net/view/830.html
//2)取第二到第四个字符
//2、分割字符串
//参考 http://c.biancheng.net/view/5807.html
String s="hello world";
System.out.println(s.substring(2));
System.out.println(s.substring(1,4));
String[] a=s.split(" ");//参数为分隔符 这里是按照空格分割
for(int i=0;i<a.length;i++){
System.out.println(a[i]);
}
}
}
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200902113417654.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3NlYW55YW5nXw==,size_16,color_FFFFFF,t_70#pic_center)