MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/javaTIL/comments/26vih0/til_you_can_write_the_main_function_like_this/
r/javaTIL • u/shazbots • May 30 '14
3 comments sorted by
7
Yep, feature since 1.5 http://docs.oracle.com/javase/1.5.0/docs/guide/language/varargs.html
You just have to make sure that argument is the last argument, otherwise Java wouldn't know where it ends and the next argument begins.
1 u/[deleted] Jun 13 '14 And the three dots are collectively called ellipsis. When a colleague first recommended to use ellipsis, I was like what is ellipsis? 0 u/[deleted] May 30 '14 [deleted] 1 u/king_of_the_universe Jun 02 '14 It has to be the last argumentExactly.you're only allowed one vararg per method/constructor argument list.You already said that. :)
1
And the three dots are collectively called ellipsis. When a colleague first recommended to use ellipsis, I was like what is ellipsis?
ellipsis
0
[deleted]
1 u/king_of_the_universe Jun 02 '14 It has to be the last argumentExactly.you're only allowed one vararg per method/constructor argument list.You already said that. :)
It has to be the last argument
Exactly.
you're only allowed one vararg per method/constructor argument list.
You already said that. :)
7
u/churro89 May 30 '14
Yep, feature since 1.5 http://docs.oracle.com/javase/1.5.0/docs/guide/language/varargs.html
You just have to make sure that argument is the last argument, otherwise Java wouldn't know where it ends and the next argument begins.