本帖最後由 tonyh 於 2013-6-8 16:25 編輯
- public class tqc203
- {
- public static void main(String args[])
- {
- if(args.length==1)
- {
- String str[]=args[0].split(",");
- System.out.println("逗號隔開的字串個數共有: "+str.length);
- for(int i=0; i<str.length; i++)
- {
- System.out.println((i+1)+"."+str[i]);
- }
- }else
- {
- System.out.println("參數錯誤!字串不得有空白或必須以逗號隔開!");
- }
- }
- }
複製代碼 |