Why is the main method static in Java

 Because the object is not required to call the static method. If we make the main method non-static, JVM will have to create its object first and then call main() method which will lead to the extra memory allocation

Comments

Popular posts from this blog

Triggers in Salesforce Tutorial

differences between the constructors and methods

Width and Height Attributes