Why is the main() method declared static?

Asked 21-Dec-2017
Viewed 666 times

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...