Tuesday, November 30, 2010

why main class is public and main is static public

Usually word public means that class is accessible for all. Using public keyword with main mehod containing class means that class cobsisting main method should be accessible for other classes.
Static Keyword means that method is accessible at class level without need to create object first as no object could be created before main method called (main is entry point of any programme) so thats why main method is created at class level not object level.

No comments:

Post a Comment