The
public static void main(String[] args) // starting a program in Java
is one of the strange line for Java beginners. It automatically trigger a question, why its like that. Compared to
void main() // starting a program in C
in C which are much simpler.
So what does it means?
First of all lets go back to main, and void main.
Main is basically the entry point of the program. The main program then can invoke any other function.
void means the main program returns nothing to the operating system.
So what is public and static for in Java?
Public – Public is to declare that the method main is a public method. Main method must be public so that Java Virtual machine can find the main method.