Thursday, June 01, 2006

Need of static in main

The static keyword is needed in the main () so that the interpreter can access the method right from the class instead of requiring an object. As you know of objects so far, you should know that normally a class is just a template for individual objects. A nonstatic method can be called only if an object has been created from a class. A static method can be called without any objects being created.

0 Comments:

Post a Comment

<< Home