I\'m just beginning to write programs in Java. What does the following Java code mean?
public static void main(String[] args)
What
Those are for command-line arguments in Java.
In other words, if you run
java MyProgram one two
Then args
contains:
[ "one", "two" ]
public static void main(String [] args) {
String one = args[0]; //=="one"
String two = args[1]; //=="two"
}
The reason for this is to configure your application to run a particular way or provide it with some piece of information it needs.
If you are new to Java, I highly recommend reading through the official Oracle's JavaTM Tutorials.