Can we write a java program without main() and by writing static block | Sololearn: Learn to code for FREE!
+ 1

Can we write a java program without main() and by writing static block

YES up to jdk 1.6 version one can write a java program without main() and any by writing only static block. from jdk 1.7 version onwards the above program will be complie but it will not execute we get compile time error saying that main() be define.

31st Mar 2017, 6:40 PM
Deepak Ghodase
Deepak Ghodase - avatar
2 Answers
+ 13
Ok, not a question, but information ^^
31st Mar 2017, 6:51 PM
Tashi N
Tashi N - avatar
+ 11
...and that is our contributor @Deepak Ghodase who has given the latest Java update For Sololearn Channel. Thank you for watching.
1st Apr 2017, 3:38 PM
Agus Mei
Agus Mei - avatar