The main() is static so that it can be invoked by the runtime engine without creating an instance of the class.
btw, it is just a convention to call this function "main". java.exe will try find the main() function to run. (You can actually write your own version of java.exe to change this name)
Reference:
http://stackoverflow.com/questions/146576/why-is-the-java-main-method-static
No comments:
Post a Comment