In java, the main() method is the entry method of a java application. That is, the main() method is the first method executed when the program is running. This method is quite different from other methods, such as the method name must be main, the method must be of type public static void, the method must be an argument that takes an array of strings, and so on.
Because the main() method is called by the Java virtual machine, it must be public. When the virtual machine calls the main() method, it does not need to produce any objects, so the main() method is declared static and does not need to return a value, so it must be declared void!
It is not necessary that the main class of a java application be public. It is possible to run