0
What if the main method is just " void main( Strings [args])" instead of Public static (Strings [args])
What is the significance of adding public static in front of main method in java. Can a main method be written without "public static". What will happen if we write a main method without "public static"
1 Antwort
+ 1
Well you can try doing so.
Public here we use because we all know main is the very first method to be called, so it should be public to be called.
Static because if we talk about a method (main) of a class, it should be called by an instance which we don't declare to call main(), thus we make it static to be called without an instance (object).