Does every runnable java program have main method? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 12

Does every runnable java program have main method?

19th Apr 2017, 6:25 PM
kodi rud
kodi rud - avatar
3 Answers
+ 11
But you could also use static {}, right?, this would also execute but with runnable exception?
20th Apr 2017, 5:11 AM
kodi rud
kodi rud - avatar
+ 9
Yes, if it is a stand-alone (not web) application. The main method is the entry point. The JVM will look for this method and begin to execute your program from this entry point.
19th Apr 2017, 7:01 PM
Tashi N
Tashi N - avatar
0
yes
13th May 2017, 11:21 PM
Romulo Sanglard
Romulo Sanglard - avatar