返回Java异常

Man*_*shS -2 java exception

public class TestException {

    int m1() {

        try {
            int i = 10, j = 0;
            System.out.println("s1");
            i = i / j;
            return 11;
        } catch (Exception e) {
            System.out.println("s2");
        } finally {
            System.out.println("s3");
        }

        System.out.println("s4");
        return 2222;
    }

    public static void main(String[] args) {
        System.out.println(new TestException().m1());
    }
}
Run Code Online (Sandbox Code Playgroud)

O/P: -

s1
s2
s3
s4
2222
Run Code Online (Sandbox Code Playgroud)

s3以前为什么s4

finally在方法返回之前不调用?

我在这里错过了什么?

Rak*_* KR 6

因为,试一试的流程终于阻止了

在此输入图像描述

  • +1美丽的原始绘画. (2认同)
  • 错误的理解......谢谢! (2认同)