Why is the code
void methodThrowsException() /*throws Exception*/{
try {
// throw new Exception();
} catch (Exception e) {
throw e;
}
}
well compiled?
AFAIK compiler doesn't analyse code for can it throw an exception or not.
Here obvious throw e;
will never run (due to commented // throw new Exception();
), but why does compiler know this?