java的命令行参数到底怎么用,请给截图和实际的例子

8.2 命令行参数示例(实验)
public class Test {
public static void main(String[] args){
        if(args.length==0){
               System.out.println("you don't set command line parameters!");
        }else{
               for (int i=0; i
                     System.out.println("args[" + i + "] is: " + args[i]);
            }
       }
}
}



when use eclipse, don't "run as application",directly use "run configurations/run", then add in aguments in program arguments.(当运行eclipse,不要"run as application",而直接用"run configurations/run",然后加上参数在,program arguments.)

更多详情请见:http://www.mark-to-win.com/index.html?content=JavaBeginner/javaUrl.html&chapter=JavaBeginner/JavaBeginner1_web.html#CommandLinePar

猜你喜欢

转载自www.cnblogs.com/mark-to-win/p/9690218.html