Nothing happens. The code will run fine. you can have public/private/protected methods. main in one of the method if you make protected. But if you want to execute this as an application then you have to give public static void main.
RE: What happens if public static void main(){} is mad...
Nothing happens. The code will run fine. you can have public/private/protected methods. main in one of the method if you make protected. But if you want to execute this as an application then you have to give public static void main.
RE: What happens if public static void main(){} is mad...
If we made it private then its scope gets changed ie private and hence while runing any java program it will call main method first as becasue its scope is public and hence if it is private then the main would not gets called implicitly we have to call that explicitly
RE: What happens if public static void main(){} is mad...
It gets compiled but at run time it says that it is not public. Because JVM is not capable to access the static method of main class. Actully JVM is present out side of the class so access modifier is not allowed to do to access the main method.
RE: What happens if public static void main(){} is made protected?
It gets compiled but at run time it says that it is not public. Because JVM is not capable to access the static method of main class. Actully JVM is present out side of the class so access modifier is not allowed to do to access the main method.