Results 1 to 6 of 6
- 04-13-2012, 04:56 PM #1
Senior Member
- Join Date
- Apr 2012
- Posts
- 129
- Rep Power
- 0
public static void main(String... args)???
Hello All!
I"m working with some source code and am seeing the title above as the main line:
public static void main(String... args) {
I'm unclear on what the ellipsis is used for in this example... as I learned that ths line should be written as:
public static void main(String[] arguments) {
... however when I go to compile the file, i get no complaints??? I attempted to google "String... args" but get nothing really relevant. Can someone shed some light on this? is "String..." the same as "String[]" and is "args" the same as "arguments" ?
Thanks!
- 04-13-2012, 05:16 PM #2
AN21XX
- Join Date
- Mar 2012
- Location
- Munich
- Posts
- 297
- Rep Power
- 2
Re: public static void main(String... args)???
Stands for many arguments of the same sort... apparently is the same as Strings[]. I would use the [] syntax...
It is called 'varargs' - take a look here: Varargs
- 04-13-2012, 07:22 PM #3
Senior Member
- Join Date
- Apr 2012
- Posts
- 129
- Rep Power
- 0
Re: public static void main(String... args)???
Thanks for the info!
After reading the link you provided, I think i understand that the "args" is used for multiple arguments.
But you mention using "Strings[]" ... is that the same as "String[]" ? I only ask because the link you provided only shows the "String[]" without the plural "s'.
Thanks for the clarification!
- 04-13-2012, 07:41 PM #4
- 04-13-2012, 07:48 PM #5
Senior Member
- Join Date
- Apr 2012
- Posts
- 129
- Rep Power
- 0
Re: public static void main(String... args)???
Ok thanks!
:-)
- 01-10-2013, 08:30 AM #6
Re: public static void main(String... args)???
Deleted a post that adds no value whatsoever to this old and answered thread. rasmita4, please check the date on an old thread and don't post again until you have gone through these three links:
Forum Rules
Guide For New Members
BB Code List - Java Programming Forum - Learn Java Programming
db
THREAD CLOSEDWhy do they call it rush hour when nothing moves? - Robin Williams
Similar Threads
-
Q?> about public static void main(String args[])
By boblingwide in forum New To JavaReplies: 4Last Post: 03-23-2012, 11:17 AM -
This is an error? public static void main(String args[])
By Jackount in forum New To JavaReplies: 10Last Post: 07-10-2011, 08:37 AM -
Public static void main (String args[])
By arefeh in forum New To JavaReplies: 12Last Post: 01-28-2010, 11:58 AM -
Error: LengthCharAt.java:3: ';' expected public static void main (String[] args)
By antgaudi in forum New To JavaReplies: 9Last Post: 11-22-2008, 11:03 PM -
[SOLVED] Why main() in java is declared as public static void main?
By piyu.sha in forum New To JavaReplies: 5Last Post: 10-06-2008, 12:11 AM


1Likes
LinkBack URL
About LinkBacks


Bookmarks