I have written a simple class with one static block
class Hello
{
static {
System.out.println(\"Hello\");
System.exit(0);
}
}
The program doesn't execute because from JDK 1.7 oracle has put the restriction on static block and static variable calling method if your program doesn't have main method with proper signature but static block and method will always be execute first.As memory management of static variables are done at the time of class loading.