Section 7.14 Using Command-Line Arguments

• Passing arguments to main (p. 283) from the command line is achieved by including a parameter of type String[] in the parameter list of main. By convention, main’s parameter is named args.

• Java passes command-line arguments that appear after the class name in the java command to the application’s main method as Strings in the array args.

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.