System.exit(0);
是退出系统了,当然不能运行输出语句啦!
说finally中的语句一定能运行指的是针对可捕捉的异常处理,对于非可捕捉的仍然是无能为力

解决方案 »

  1.   

    就是说如果发生了Error和RunTimeException,
    都是不能执行finally{}了?
      

  2.   

    你可以做个测试,测试程序如下:
    import java.lang.*;
    public class fina
    {
    public static void main(String[] args) 
    {
    try
    {

    }
    finally
    {
    System.out.println("Hello World!");
    }
    try
    {
    throw new Exception("Exception");
    }
    catch(Exception e)
    {
    System.out.println("Catch Exception");
    }
    finally
    {
    System.out.println("finally!");
    } }
    }
      

  3.   

    这个问题好象很久就有争论了: finally到底是在找不到异常处理的情况下执行的还是无论找到与否都会执行啊。至于楼主的问题嘛,肯定不会执行finally的,都退出程序块了啊。