Why is the main() method declared static?

Asked 7 years ago
Viewed 730 times

1

Why is the main() method declared static?


1 Answer


0

The main() method is declared static because it's called by JVM before instantiation of the class. And it's also necessary because it's called by JVM before any objects are made. Due to this, we declare main() method static because they can then be invoked by the runtime engine without having to instantiate an instance of the parent class.

Hope it's informative for you...

answered 7 years ago by Hemant Patel

Your Answer