Answer:
. The Main() method serves as the entry point of the code.It is automatically loaded and initialised by the CLR when the class loader in the CLR loads the class.If it were not static, an extra object of the class has to be created, that would increase the memory overhead.
. The other reason for being static is to prevent its overriding and not allowing it to be accessed through an object reference of derived class.
. Static will also have compile time memory allocation.
Asked In: Many Interviews |
Alert Moderator