什么是正确的Java main()方法参数语法? [英] What is the correct Java main() method parameters syntax?
本文介绍了什么是正确的Java main()方法参数语法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这些方法之间是否存在功能差异?
Is there a functional difference between these methods?
public static void main(String[] args) { }
public static void main(String args[]) { }
EDIT(从其他贡献者处添加此语法):
EDIT (added this syntax from other contributors) :
public static void main(String... args) { }
推荐答案
不,但第一种是首选款式。
No, but the first is the prefered style.
编辑:
另一种选择是
Another option is
public static void main(String... args)
还允许调用者使用varargs语法。
which additionally allows callers to use varargs syntax.
这篇关于什么是正确的Java main()方法参数语法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文