+ 2

Make a program in java without main method

you have to code a program that has not a main method but prints or shows our calculation without any error...

31st May 2018, 4:12 AM
Sumit
Sumit - avatar
4 Answers
+ 2
sumit singh 😂👍
6th Jun 2018, 3:52 AM
Nura Programmer
Nura Programmer - avatar
+ 1
is that a CHALLENGE or a question
31st May 2018, 4:47 AM
Nura Programmer
Nura Programmer - avatar
0
question
31st May 2018, 5:18 AM
Sumit
Sumit - avatar
0
/*but it doesn't compile here in sololearn editor... I have checked it in my PC which has jdk 10 installed*/ abstract class test extends javafx.application.Application{ static{ int a=9; System.out.println("Hello world... without main"); System.out.println("square of "+a+" is: " +(a*a)); System.exit(0); } } /*Check in your PC,in case of error please notify me*/
5th Jun 2018, 11:39 AM
Sumit
Sumit - avatar