Java的:当超过字符串ARGS使用字串[] args [] [英] Java: When to use String[] args over String args[]
本文介绍了Java的:当超过字符串ARGS使用字串[] args []的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经搜查,但我无法找到我一直在寻找的,所以我带着一个新的问题,希望你们能告诉我,什么时候应该使用
公共静态无效的主要(字串[] args)
在
公共静态无效的主要(字符串ARGS [])
解决方案
有绝对不亚于也许可读性两者的区别,其他。
创建像数组字符串ARGS []
允许简单一些神似添加到C / C ++。
您应该总是preFER 字串[] args
。
请注意,有一个第三个选项太多,使用可变参数:
公共静态无效的主要(字符串参数... args)
I already searched, but I couldn't find what I was looking for, so I come with a new question, hoping y'all can tell me, When should I use
public static void main(String[] args)
over
public static void main(String args[])
解决方案
There is absolutely no difference between the two, other than perhaps readability.
Creating arrays like String args[]
is allowed simply to add some likeness to C/C++.
You should always prefer String[] args
.
Note that there is a third option too, using varargs:
public static void main(String... args)
这篇关于Java的:当超过字符串ARGS使用字串[] args []的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文