This week's book giveaways are in the iOS and Features new in Java 8 forums.
We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Question about 'public static void main( String args[] ) ' Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Question about Watch "Question about New topic
Author

Question about 'public static void main( String args[] ) '

Atrus Greyor
Ranch Hand

Joined: Mar 07, 2004
Posts: 110
what exactly does the "(String args[])" mean???
fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11644
    
  17

this is a parameter being passed to the method, just like every other method. in this case, it is an array of string from the command line. if you ran
c:\java myClass input1 input2 input3
you would get an array of strings, called args, with 3 elements in it.
args[0] = "input1"
args[1] = "input2"
args[2] = "input3"
the name of the array, args, is traditional, but you could call it anything.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Nigel Browne
Ranch Hand

Joined: May 15, 2001
Posts: 673

what exactly does the "(String args[])" mean???

It means that an array of String objects can be passed to the method. The array will be entitled "args".
Hth
Nigel
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Question about 'public static void main( String args[] ) '