/** A program that demonstrates the use of the 
  command-line arguments, see p. 82 of the textbook;
  run the program as follows:
    java Arguments arg1 arg2 ...
  where arg1, arg2, etc., are the command-line arguments
  passed to the main()
 */
public class Arguments {
  public static void main(String[] args) {
    int count = args.length;
    if (count == 0) { // no arguments passed to main()
      System.out.println("Usage: java Arguments arg1 arg2 ...");
      System.exit(-1); // terminate
    }
    // otherwise, output the arguments to the screen, one per line
    System.out.println("Command-line arguments are:");
    for (int i = 0; i < count; i++)
      System.out.println(args[i]);
  }  // end of main()
}
