不会执行.除非有finally,(不过finally我没试验)

解决方案 »

  1.   

    看看这段试验代码,就清楚了.
    public class TestThrow {
    public static void main(String[] args) throws Exception{
    int a = 0;
    int b= 1;
    try{
    if (a!=b)
      throw new  Exception("抛出了异常");
      System.out.println("抛出异常后不会执行本语句");
            }
            finally{
             System.out.println("最后一定会执行的语句");
            }

    }
    }输出结果:
    最后一定会执行的语句
    Exception in thread "main" java.lang.Exception: 抛出了异常
            at TestThrow.main(TestThrow.java:8)