Simple Basic Java Software – analysing arguments from command line


You want a simple bit of java code that takes arguments from the command line and displays them.


Good demo on how to obtain and handle java arguments.

public class Arguments {  public static void main(String argv[]) {    if(argv.length > 0) {      System.out.println("args exec w " + argv.length + " args");        for(int i=0;i...


Here is a demo:

# java Arguments -a -x -yargs exec w 3 argsargv[0] = -aargv[1] = -xargv[2] = -y


Leave a Reply

Your email address will not be published. Required fields are marked *