提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
通过命令行执行传递参数
/** 来自 n o w j a v a . c o m**/ public class Main { public static void main(String[] args){ if(args.length > 0){ System.out.println("Arguments that were passed to the program: "); for (String arg:args){ System.out.println(arg); } } else { System.out.println("No arguments passed to the program."); } } }