Thursday 28 June 2018

Why main() in JAVA is public !!

Answer :
              main() in JAVA is public due to the following two reasons:

1. main() method can be accessed by any no. of classes.
2. main() method can be invoked by JVM from everywhere.


Note: The keyword public is a modifier.