3.6 Command line arguments |
For instance if the following command was executed:
java TestArguments AAAA BBBBThen in the void main method of the TestArguments, args[0] would equal "AAAA" and args[1] would equal "BBBB".
In Java the length statement will return the number of items in the array. So the following bit of code will return the number of command line arguments passed to the void main method:
args.lengthThe command line parameters can be used to pass useful startup parameters or information to a java application.