What are command line arguments in Java?

Command line arguments are used to send information to a program at run time. To run such a program, to have to enter the name of program in command line.

For Example:

class CL {

public static void main(String args[ ]) {

for(int a=0; a<args.length; a++)

System.out.println(“args[” + a + “]: ” +




To execute the program:

java CL More Process


args[0]: More

args[1]: Process

Leave a Reply