CommandInput.java
/*
*命令行參數的輸入,從命令行輸入的任何參數,對于java來講都是用字符串處理的
*/
public class CommandInput{
public static void main(String[] args){
if(args.length==0){
System.out.println("你沒有輸出參數,程序退出");
}
else{
System.out.println("你一共輸入了"+args.length+"個參數");
if(args[0].equals("h"))
System.out.print("hello");
if(args[0].equals("g"))
System.out.print("Bye-Bye");
for(int i=1;i<args.length;i++)
{
System.out.print(" "+args[i]);
}
}
}
}
*命令行參數的輸入,從命令行輸入的任何參數,對于java來講都是用字符串處理的
*/
public class CommandInput{
public static void main(String[] args){
if(args.length==0){
System.out.println("你沒有輸出參數,程序退出");
}
else{
System.out.println("你一共輸入了"+args.length+"個參數");
if(args[0].equals("h"))
System.out.print("hello");
if(args[0].equals("g"))
System.out.print("Bye-Bye");
for(int i=1;i<args.length;i++)
{
System.out.print(" "+args[i]);
}
}
}
}
posted on 2008-10-22 08:20 郭興華 閱讀(147) 評論(0) 編輯 收藏 所屬分類: TESTARRAY