当前页面: 开发资料首页 → J2SE 专题 → 请问这个要求输出的是什么 怎么实现??
请问这个要求输出的是什么 怎么实现??
摘要: 请问这个要求输出的是什么 怎么实现??
1. Create a program that outputs command-line arguments:
(1) Create a program that outputs every command-line argument, then displays the arguments and their number.
(2) You should use the array variable length to retrieve the length of the array.
让你输出命令行参数和他们的号。我想不用别人告诉你怎么写这个程序吧
比如说java Test aaa bbb ccc
是不是就是输出aaa bbb 和ccc啊?
class test
{
public static void main(String[] args)
{
if(args.length==0)
{
System.out.println("No Command Line arguments!");
return;
}
for(int i=0; i
{
System.out.println(i+","+args[i]);
}
}
}
运行:
javac test.java
java test aaa bbb ccc ddd
输出:
0,aaa
1,bbb
2,ccc
3,ddd
哦 就是我说的那个意思啊 谢谢了