Came accross this weird issue yesterday. Can't seem to find any logical explanation in the java spec for the following...
public class Program {
public static void main(String[] args) {
int i = 0;
try {
bork(i++);
} catch (Exception e) {
}
System.out.println(i);
}
private static void bork(int i) {
throw new RuntimeException();
}
}
One would think post-increment would not happen because bork throws the exception, but it does!
What is the explanation for this behavior?