英文:
What is use of String args[] in Java?
问题
因为我是一个初学者,我不太能理解为什么要使用String args[],我想知道我们为什么要使用它。
英文:
I want to know that why do we use String args[] because I am a beginner and I am not able to understand why do we use it.
答案1
得分: 1
以下是您在运行程序时传递给程序的参数。
例如,您可以运行 java MyProgram -param -verbose -enableSomething -key=value
所有这些 -param
、-verbose
等都是这些参数。
请参阅文档:https://docs.oracle.com/javase/tutorial/essential/environment/cmdLineArgs.html
英文:
These are the parameters which you pass to your program when running it.
For example, you can run java MyProgram -param -verbose -enableSomething -key=value
All these -param
, -verbose
, etc are those arguments.
See docs: https://docs.oracle.com/javase/tutorial/essential/environment/cmdLineArgs.html
专注分享java语言的经验与见解,让所有开发者获益!
评论