The code snap is like below:
public static void main(String[] args) {
System.out.println(echo("jjj"));
}
public static String echo(String str) {
try {
int a = 1/0;
} catch (Exception e) {
throw e;
} finally {
return str;
}
}
Why can I get the output and no exception occurs?
And if I put the return clause out of finally, then exception occurs.
How could return
(in finally
) stop exception
?