This is the question which I got "Write a program to read and display 2 command line arguments and the length of the command line argument array."
This is my answer in Java..Is this correct ?
int length = args.length;
for(int i = 0;i<length; i++)
{
System.out.println(args[i]);
}
System.out.println("Length is " + args.length);
}
You should only display 2 arguments?
for(int i = 0; i< args.length && i < 2; i++)
{
System.out.println(args[i]);
}
System.out.println("Length is " + args.length);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.