Possible Duplicate:
Returning in a static initializer
Is there a way to exit a static initialiser in Java, something like the code below (which does not compile):
public class Test {
private static int i = 1;
static {
if (i == 0) {
return; // DOESN'T COMPILE
}
i = 0;
}
}
ps: yes I know, the example makes no sense, i == 0
will always be false at this point, but that's not the point!