+ 4
What is the use of "static" in public static void main(String[] args) ?
2 Respuestas
+ 7
Because, in Java a function or variable in class in unaccessible untill an Object is created from the class, but the 'main' function is supposed to run at startup(without Object initiation) by JVM. So the 'main' is declared public as well as static so that it can be accessed outside class & without even an Object is created.
https://www.quora.com/Why-do-we-use-%E2%80%9Cpublic-static-void-main%E2%80%9D-only-in-Java
+ 5
static helps the main method to get loaded without getting called by any instance/object.