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
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
0 comments:
Post a Comment