Can a java program can run without main() method? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Can a java program can run without main() method?

18th Jun 2017, 10:48 PM
sandeep kaur
2 Answers
+ 3
No, you can't run a java program without main() In java 6 and earlier, you can use Static Blocks ( http://docs.oracle.com/javase/tutorial/java/javaOO/initial.html ), but there isn't a practical reason to do that.
18th Jun 2017, 11:34 PM
⏩▶Clau◀⏪
⏩▶Clau◀⏪ - avatar
0
No because the main method serves as the starting point of a program's execution.
19th Jun 2017, 9:34 PM
Seth Moga
Seth Moga - avatar