Posts

Showing posts with the label Command Line Argument

Command Line Argument in Java

Comm and Line Argument :  The java command-line argument is an argument i.e. passed at the time of running the java program. The command-line arguments are passed to the program at run-time.  The arguments passed from the console can be received in the java program and it can be used as an input. So, it provides a convenient way to check the behaviour of the program for the different values. You can pass N (1,2,3 and so on) numbers of arguments from the command prompt. Command Line Arguments can be used to specify configuration information while launching your application. There is no restriction on the number of java command line arguments. You can specify any number of arguments Information is passed as Strings.They are captured into the String args of your main method. The first command-line argument is stored at args[0], the second at args[1], and so on.  Example  While running a class cmd, you can specify command line arguments as $java cmd arg...