+ 1
Is java program can run without main method?means any other way?
7 Answers
+ 1
Why would you want that? And no, The JVM on startup looks for that. Apparently prior to Java 7 you could through the usage of static blocks but not now. No good point to do so though
+ 4
no there is no other way to run without main method
+ 2
no there is no other way to run without main method
+ 2
before 1.5v jdk version there was a way from by executing from static block ..
but after 1.5v no way...
+ 2
we can compile it but can not run it. there is run static block and than main method is not found earror gives.
+ 1
yes you can run a without main method
by putting your code inside static block
0
Yes you can run but you have to exit at the end of static block this is Upto java 1.6.but in java 7 they removed and in java8 you can use javaFX and run your code