What is the purpose of main function in Java?

From version JDK6 onwards, the main method is mandatory to start code execution. If your program does not contain "main" method, you will get a run-time error. Please note that in the absence of "main" method your entire program will successfully compile but it will throw an error at runtime.

Suggest An Answer

No suggestions avaliable!

Latest post from Core Java interview questions

Ask Question