package sample; public class CommandParameter { public static void main(String[] args) { String firstparameter = null; if (args.length== 0){ firstparameter="デフォルト値"; } if (args.length >= 1){ for (int i=0; i<args.length; i++) { if(i==0) { firstparameter=args[0]; } else { System.out.println("第" + (i+1) +"引数:"+ args[i]); } } } System.out.println("filename:" + firstparameter); System.exit(0); } }