java command line arguments
class CommandLineExample{ public static void main(String args[]){ System.out.println("Your first argument is: "+args[0]); } } //Now follow these steps compile by > javac CommandLineExample.java run by > java CommandLineExample sonoo
Here is what the above code is Doing:
1. The main() method accepts an array of String objects.
2. The first element of the array is accessed and printed.
3. The program is compiled and run as follows:
javac CommandLineExample.java
java CommandLineExample sonoo