This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
well, the obvious answer is that one takes a String array as a parameter, and the other doesn't. The one that does take the parameter is the one that is called when you try and start up things. if you don't write it, your program can't start.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Originally posted by marc weber: Note that in addition to the String argument, main used as an entry method must be public and static, with a return type of void.
I can't resist tossing out this Java parlor trick...
There is a trick hidden in that code. Try removing that System.exit(0); from the code and compile and run the code,then you will get a Exception after printing the message Exception in Thread main java.lang.noSuchmethodError;main
Originally posted by Balasubramanian Chandrasekaran: ... Try removing that System.exit(0); from the code and compile and run the code,then you will get a Exception after printing the message Exception in Thread main java.lang.noSuchmethodError;main
Right. The class loads and the static block executes, providing the output. The call to System.exit(0) shuts down the program before it realizes there is no main method.