I have written a simple class with one static block
class Hello { static { System.out.println(\"Hello\"); System.exit(0); } }
Yes, in jdk7. Static blocks are not first executed. It looks first for the entry point in the application.
So, it first checks for public static void main(String a[]) , if this method is not present, static block will not be executed.
public static void main(String a[])