PDA

View Full Version : Java Command Line Arguments


antagonist
12-12-2008, 08:12 AM
This class demonstrates how command line arguments are passed in Java. Arguments are passed as a String array to the main method of a class. The first element (element 0) is the first argument passed not the name of the class.


Source Code

An example that prints in the command line arguments passed into the class when executed.


public class ReadArgs
{
public static final void main(String args[])
{
for (int i=0;i<args.length;++i)
{
System.out.println( args[i] );
}
}
}




Sample Run

With the following command line, the output shown is produced.

java ReadArgs zero one two three


Output:

The following command line arguments were passed:
arg[0]: zero
arg[1]: one
arg[2]: two
arg[3]: three


information taken from freejavaguide.com

LYRiiCz
12-12-2008, 08:13 AM
Ripped.

http://www.freejavaguide.com/java_commandline.htm

-Ollie.

antagonist
12-12-2008, 09:40 AM
Dude these are very basic tutorials found all over the web and are possibly impossible not to rip portions or all of it from someone else. they are intended to help beginners in java, not for me to get credit.

LYRiiCz
12-12-2008, 10:43 AM
Dude these are very basic tutorials found all over the web and are possibly impossible not to rip portions or all of it from someone else. they are intended to help beginners in java, not for me to get credit.

Put it in the post then.
Say 'this is not my work'.
and put the url.
Because you will end up getting banned for leeching/ripping.

-Ollie.

Jesse
12-12-2008, 05:36 PM
Dude these are very basic tutorials found all over the web and are possibly impossible not to rip portions or all of it from someone else. they are intended to help beginners in java, not for me to get credit.


Yeah, they're common, but the likelihood of you writing the SAME exact tutorial, word-for-word, is unheard of.

Banned.

bombs pure
04-02-2009, 10:16 AM
Stupid leecher.

Enquire
07-06-2009, 01:24 AM
Crap, sorry for gravedig, forgot to look at the post
/delete?