Can we Execute Java program without main() Method? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can we Execute Java program without main() Method?

7th Sep 2018, 6:13 PM
Slim Jxmmi
5 Answers
+ 4
No,we require main() method for execution of program
7th Sep 2018, 6:21 PM
Yesh Jadav
Yesh Jadav - avatar
+ 3
what about static block?
8th Sep 2018, 7:43 PM
Linda
Linda - avatar
+ 1
no
9th Sep 2018, 9:20 AM
Chhagandas Pawar
Chhagandas Pawar - avatar
0
You can compile your Java program without main() method and check whether systax is correct or not. But to check output of your program you have to create a main() method.
17th Sep 2018, 9:37 AM
Vijay Meena