
What is command line argument in Java and how one can use it to create a program in Java? Can you post any example of command line argument program in Java?? It will be really helpful for the beginners like me.

Command line arguments allow the user to affect the operation of an application. A Java application can accept any number of arguments from the command line. Arguments are passed as a string array to the main method of a class.
Here is an example:
public class CommandLineArguments{
public static void main(String[] args){
System.out.println("These are the command line arguments:");
for (int i=0; i < args.length; i++){
System.out.println("arg[" + i + "]: " + args[i]);
}
}
}
Now while executing this example, you need to give the arguments along with class name as below:
java CommandLineArguments A B C D

Please visit the following link:
http://www.roseindia.net/java/beginners/cmnd-line-arguments.shtml

Please visit the following link:
http://www.roseindia.net/java/beginners/cmnd-line-arguments.shtml