+ 1
Why is the main method made static?
2 Antworten
+ 3
Because it need to be called without making an instance of the class.
+ 3
The main method is the entry point of execution in java. Hence it should available to JVM for execution before any objects to be created.. If it not static, then we need an object to call that method but objects are created at run time only.. So there raises an confusion for JVM..
Edit:
For some more clarity.. See this link 5th point...
https://www.google.com/amp/s/www.geeksforgeeks.org/understanding-static-in-public-static-void-main-in-java/amp/