This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes command line Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "command line" Watch "command line" New topic

command line

Zahra Vir

Joined: Dec 04, 2004
Posts: 4
Can someone help explain the concept of using the arg thingy in
public static void main (String args[])

so far i know that args can be named anything and that u can use it to get specific words ???

can someone elaborate a bit or provide some sort of example for this

Ed Lance
Ranch Hand

Joined: Aug 02, 2000
Posts: 38
Suspect this has been answered here before but here's a start for you.

args is just a variable could call it any legal identifier, it's simply the name of our String array.

After compiling, run this code from the command line with the "args" separated by a space, like this.

java CommandLineExample firstval secondval thirdval

Hope that helps!
I agree. Here's the link:
subject: command line
Similar Threads
Regex question
Casting of Arrays and Object
How does this " if " statement behave
args[] and ==
How can i get heapdump args under JRockit R26.3 1.4.2