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

General Interview Questions and Answers

20 Performance Testing Interview Questions and Answers

Leadership: a Definition