Command Line Arguments in Java Tutorial
Command Line Arguments in Java Tutorial
Arguments in Java
Objectives
At the end of the lesson, the student
should be able to:
Know and explain what a command-line
argument is
Get input from the user using command-line
arguments
How to pass command-line arguments in
Command prompt
Command-line Arguments
• Command line arguments means a way to
pass parameters to the main function while
executing the program.
• A Java application can accept any number of
arguments from the command-line.
• Command-line arguments allow the user to
affect the operation of an application.
• The user enters command-line arguments
when invoking the application and specifies
them after the name of the class to run.
Command-line Arguments
• For example, suppose you have a Java
application, called Sort, that sorts five
numbers, you run it like this: