exception中finally的使用

package com.te.exp;

/**
 * finally 的使用
 */
public class StudyExcep {
    public static void main(String[] args) {
        try {
            int[] arr = new int[3];
            arr[3] = 100;
            System.out.println("资源释放了。。。。");
        }catch (Exception e){
            e.printStackTrace();
            System.out.println("报错了 ");
        }finally {
            System.out.println("无论结果如何,资源一定要释放");
        }
    }
}

原文地址:http://www.cnblogs.com/ch2020/p/16852416.html

发表评论

您的电子邮箱地址不会被公开。