因此,在创建 Java 类之后,我不确定如何开始或放置以下说明的代码:
The format of this file is a list of persons'names, one per line. The program will read these names and store them in an array.
如果没有给出命令行参数,程序将简单地创建一个空数组,用于存储名称。
帮忙? :)
最佳答案
选择程序并右键单击并选择运行配置。
在运行配置窗口中,您将看到参数选项卡,在程序参数中输入文件名。
可以通过类的 main 方法中传递的 String [] 参数来访问此文件名。
关于java - 如何启动一个带有可选命令行参数(即文件名)的 java eclipse 程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34149788/