问题描述
如何解释初学者, String args []
的含义以及 static 在以下摘录中?
How can you explain very well, to a beginner, the meaning of String args[]
and the use of static
in the following excerpt?
class FirstApp {
public static void main(String[] args) {
...
}
}
推荐答案
我想指一位初学者参加,然后补充它。
I would point a beginner to the Wiki article on the Main function, then supplement it with this.
-
Java只开始运行具有特定<$ c的程序$ c> public static void main(String [] args)签名,人们可以想到签名就像他们自己的名字一样 - 这就是Java如何区分别人的
之间的区别main()
和一个真正的main()
。
Java only starts running a program with the specific
public static void main(String[] args)
signature, and one can think of a signature like their own name - it's how Java can tell the difference between someone else'smain()
and the one truemain()
.
String [] args
是一个 String
的集合,用空格分隔,可以输入终端上的程序。更多的时候,初学者不会使用这个变量,但总是存在以防万一。
String[] args
is a collection of String
s, separated by a space, which can be typed into the program on the terminal. More times than not, the beginner isn't going to use this variable, but it's always there just in case.
这篇关于“String args []'和'public static void main(String [] args)'中的静态的解释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!