
Shao X. answered 04/19/19
I am a software engineer at Amazon
what do you mean command line arguments?
Shao X. answered 04/19/19
I am a software engineer at Amazon
what do you mean command line arguments?
Patrick B. answered 03/16/19
Math and computer tutor/teacher
String args[] is an array of strings that contain the command line arguments.
a[0] is the first command line argument
a[1] is the second command line argument
a[2] is the third command line argument
etc.
THe following command line prompt passes 4 command line arguments to the program myprog.
EX> javac myprog.java
EX>. java myprog one two three four <ENTER>
a[0] = "one"
a[1] = "two"
a[2] ="three"
a[3] = "four"
Here's the code:
// tests command line paramters
class CLP
{
public static void main(String args[])
{
for (int iLoop=0; iLoop<args.length; iLoop++)
{
System.out.println(args[iLoop]);
}
}
}
Get a free answer to a quick problem.
Most questions answered within 4 hours.
Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.