字符串 args[] 作为方法的输入 java
String args[] as an input for a method java
我有这段代码,我想知道 String args[] 在这里意味着什么以及它如何用作输入我阅读了很多在线评论,但仍然对此感到困惑谢谢
static int parse_commandline(String args[]) {
// TODO range check
if (args.length == 0) {
System.err.println("No options are specified.");
System.err.println("Try `--help' for more information.");
System.exit(1);
}
Options options = new Options();
options.addOption("r", "tries", true, "# number of independent trials");
options.addOption("s", "tours", true, "# number of steps in each trial");
options.addOption("t", "time", true, "# maximum time for each trial");
options.addOption("seed", true, "# seed for the random number generator");}
String args[]
等同于 String[] args
.
换句话说,args
是String
的数组。
要了解有关数组的更多信息:Arrays
我有这段代码,我想知道 String args[] 在这里意味着什么以及它如何用作输入我阅读了很多在线评论,但仍然对此感到困惑谢谢
static int parse_commandline(String args[]) {
// TODO range check
if (args.length == 0) {
System.err.println("No options are specified.");
System.err.println("Try `--help' for more information.");
System.exit(1);
}
Options options = new Options();
options.addOption("r", "tries", true, "# number of independent trials");
options.addOption("s", "tours", true, "# number of steps in each trial");
options.addOption("t", "time", true, "# maximum time for each trial");
options.addOption("seed", true, "# seed for the random number generator");}
String args[]
等同于 String[] args
.
换句话说,args
是String
的数组。
要了解有关数组的更多信息:Arrays