"static" in front of a method name means that you can call the method without actually creating the object. if you didn't have static there, main couldn't run unless you created an object, but you can't create an object until you start your program.
now, you CAN create a method like you list, but it won't be the one that the JVM tries to run when you start your program. the JVM looks for the method with the specific signiature
so if you have only one with an int array, the JVM won't be able to run your program.
at least, that's how i understand it.
Never ascribe to malice that which can be adequately explained by stupidity.
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32708
4
posted
0
You are right that it will compile but not run, because the JVM searches for the signature. It is possible to kid BlueJ into taking a main method with a different signature, but then BlueJ isn't a JVM. I have managed to get myJVM to accept these signatures:-but I don't think ti's a good idea for real-life use. CR
Jeff Albertson
Ranch Hand
Joined: Sep 16, 2005
Posts: 1780
posted
0
Syntactically, the order of modifiers (public static versus static public) isn't significant, but as a matter of style, almost all Java programmers put the access (public) first.
There is no emoticon for what I am feeling!
Layne Lund
Ranch Hand
Joined: Dec 06, 2001
Posts: 3061
posted
0
I think the "public static void main(String ...)" signature is available for any JVM that supports Java 1.5. This is the syntax for variable argument lists (varargs) that gets translated into an array anyway. There are several other variations that are allowed, but most of them are just syntactic variations on the one you are used to, like switching the order of "public" and "static".
You will probably however, have to write out a Readme.txt file to accompany your class, with a description in of what you need to pass. Otherwise you will forget.
CR
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.