What will be printed on standard output if the following class is executed using the command "java Test 1 two 3" ?
e. Code does not compile
Solution : Choice C is the correct answer.
In Java, command line arguments are stored in the args array which is an argument to the main method. The index of the args array starts with 0 and the first command line argument is the word after the classname. Thus, args will be 1 and args will be "two".
The parseInt() method of the Integer class parses the String argument to the int type. The String passed to the parseInt() method should have only digits, with an exception that it can start with '-' to indicate a negative number. Otherwise, NumberFormatException will be thrown. Thus, when "two" is passed to the parseInt() method, NumberFormatException will be thrown.
Please note that there is nothing wrong with the definition of main, the static word can come after or before public keyword.
Source : "Facebook community"