+ 1
Why java main method is public?
4 Réponses
+ 2
Main method is public so that JVM can access the main method and execute it.
+ 1
it's a rule :)
+ 1
public modifier is used in main function because when we declare a function with public modifier it is visible to all classes and it can be accessed by anything.
+ 1
so that the JVM can call it. it is the main point of entry out execution for your program.