Here We going see . How run the java program without main method.
program
class WithOutMainMethod { static { System.out.println("Am run with out main method"); System.exit(0); } }
Explanation:
In Java program static block only execute first before main method.
Then JVM will search main method, Before that we terminating the JVM By
using System.exit(0);
zero--- normal termination
nonzero -abnormal nermination
No comments:
Post a Comment