why main method is public static void in java

Solutions on MaxInterview for why main method is public static void in java by the best coders in the world

showing results for - "why main method is public static void in java"
Ed
07 Mar 2018
1Because the object is not required to call the static method. 
2If we make the main method non-static, 
3JVM will have to create its object first and then call main() method which 
4will lead to the extra memory allocation.
June
02 Mar 2018
1public : “public” is an access specifier which can be used outside the class. 
2When main method is declared
3public it means it can be used outside class.
4static : To call a method we require object. Sometimes it may be 
5required to call a method without the help of object. Then we declare that 
6method as static. JVM calls the main() method without creating
7object by declaring keyword static.
8If we make the main method non-static, 
9JVM will have to create its object first and then call main() method which 
10will lead to the extra memory allocation.
11void : void return type is used when a method does’nt return any value. 
12main() method doesn’t return any value, so main() is declared as void.
queries leading to this page
java when not to use public static void mainwhy we use static void main in javais the 22main 22 method static 3fwhat is the meaning of public static void main in javawhy do we write public static void main in javajava public static void explainedcall function in java from public static void mainwhy is main staticwhat is public static void mainwhy do we write public static in javapublic static methods javajava why main method is staticwhy main method is staticis public static void main necessary in javawhy main class is public static void mainjava psvmjava public static void mainpublic static main void javawhat is public static void run 28 29 in javawhy main method is public static void mainwhen do we use public static void main in javapublic static void method examplestatic voidjava should i static void main 3fjava public static void main call methodwhy main method should be static in javado methods need static if main what is public class and public static void in javawhy main method staticwhat is public static void main in javahow is static used in the java void mainwhy in java public static void mainpublic static method javawhy java has the public static void mainwhy public static void main is used in javawhat is string args in javastatic void methodjava static void mainwhat is static in main method of javapublic static void main means in java 28this class will have your static void main methodwhy static is used in main methodstatic use in void main 28 29 in jvaawhy main function is staticwhat does public static void main mean javapublic void static main javajava is method in main always staticpublic static main method javajava does main have to be staticwhy is the main method static 3fwhy is java main method staticwhy we use static in main methodjava is method in main class always staticstatic void main java public static void syntax javameaning of public static void mainvoid static main javacan we have static method in main method in javawhy the main is staticjava how to call a method with public static voidwhy does java need public static voidpublic static void main javapublic static void meaningexplain public static void mainwhy main method is public static void in javawhat are public static void main in javawhy is main method staticpublic static void java meaningwhy do we use static in main methodwhy is public static void main used in javajava public static how to use voidstatic in main method in javathe main method in java should be static for the reasonwhy static void main in javadoes the main method have to be static javapublic static void main in javawhy do we need public static void main in javastatic in mainwhy is main 28 29 method static 3fwhy static for main in javacan we have static method in main 28 29public static void javawhat is public static method in javajava main method in static whypublic void main in javastatic mainwhat is the need to mention static before main methodwhy static in main method javawhy the main method is static in javamain function is require to be static in java 3fjava what is public void mainthe main method should be static for the reasonwhat is public void main in javapublic static void main 28 29 2ajava main method non staticwhy public static void for main function in javawhat is need to mention static before main methodpublic static void main 28string s e2 80 a6 29why we need string args in javapublic void mainjava public static voidpublic static void main in java meaningwhy main is static in javahow public static void main works in javadoes all static method are main methodsexplain public static void main in javawhy we use public static void in mainwhat is the purpose of the method public static void main in a java program 3fmeaning of public static void main in javadoes the main method need to be staticwhy is the main method staticwhich language uses public static void mainpublic static void method javado you need public static void main in classeswhy main method is static and public in javais main necessary for staticstatic void main in javawhy in java main method is staticis it possible to have public voids in main programwhy we use static in main function in javapublic static void in javawhy does main have to be static and public javawhy java main method is staticwhy is the java main method staticwhy the main method is static in java 3fwhy we write public static void main in javapublic static void main meaning in javadoes main method have to be staticwhy main method is called staticpublic void main 28 29 7b 7dwhy is the main method static in javahow to write public static void main in javawhy is main method public in javawhy main method is static in javawhat is a public static method in javajava shortcut for public static void mainwhy main method in java is staticpublic static voidwhy public static void mainjava do main methods need to be staticwhy static is used in main method in javawhy we use public static void main in javameaning of public static void in javawhy is main method static in javastatic main javajava why is main method staticpsvm in javawhy main method is called static in javawhy is main public static void in javajava static void main inside a public staticwhy to use static with main in javawhy main method is declared staticwhy is main method void in javahow is main both public static methodwhat is the use of static in main methodwhy main method is static and publicpublic static void methodwhy main method is public static void in java