Why doesn't main use varagrs?
I was curious as to why the default main does not use varargs. Unlike other languages and scripting languages the first position of arguments (the zeroth element) does not reference the program name/package/jar
So I really I would think it would have been better to implement main in the format of:
Code:
public class foo
{
public static void main(String... args)
{
// TODO stuff with args if they exist....
}
}
The above code compiles and runs naturally, I guess the question is kind of pointless as varargs and an array are pretty much the same thing. But it seems a bit funny to me why have an array as convention when varargs is more suited for situations where you don't know if there will be zero, 1 or multiple args.