java键盘输入字符串数组

 1 import java.io.*;
2
3 public class InputStrings {
4 public static void main(String[] args) {
5 // TODO Auto-generated method stub
6 BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
7 String[] str = null;
8 try {
9 str = br.readLine().split(",");
10 } catch (Exception e) {
11 // TODO Auto-generated catch block
12 e.printStackTrace();
13 }
14 for(int i=0;i<str.length;i++){
15 System.out.print(str[i] + " ");
16 }
17 }
18
19 }
posted @ 2011-12-16 15:12  人生如若初见  阅读(3637)  评论(1编辑  收藏  举报