本帖最后由 杜光 于 2013-7-5 07:31 编辑
- package com.itheima;
- class StringDemo
- {
- public static void method_split()
- {
- String s="zhangsan,lisi,wangwu";
- String[] arr=s.split(",");
- for (int x=0;x<arr.length ;x++ )
- {
- System.out.println("字符串分割后的结果是"+arr[x]);
- }
- }
-
- }
- public class StringSplit
- {
- public static void main(String[] args)
- {
- StringDemo smd=new StringDemo();
- smd.method_split();
- }
- }
复制代码 |