viernes, 8 de agosto de 2014

Arguments

// The following is sample terminal output that
// displays the contents of the .java file
// we have written (uses the cat command),
// compiles and runs it with arguments.

$ cat Arguments.java
public class Arguments {
    public static void main(String[] args) {
        for (int i = 0; i < args.length; i++) {
            System.out.println(args[i]);
        }
    }
}
$ javac Arguments.java
$ java Arguments arg0 arg1 arg2
arg0
arg1
arg2
$

No hay comentarios:

Publicar un comentario