I've coded some in Ruby and C++, but in Java I don't understand what the String[] args
parameter to the main method does.
Many simple Java ('hello world') examples are more or less like this:
public class HelloWorldApp {
public static void main(String[] args) {
System.out.println("Hello World!");
}
}
From what I know about the syntax of other languages args
would be used to pass command line arguments to the program. However, these simple examples don't make use of command line arguments.
So, why is the args
parameter needed in situations like these when it isn't used?