首页 > 其他 > 详细

finally 语句

时间:2016-07-31 09:07:08      阅读:282      评论:0      收藏:0      [点我收藏+]
package unit5;

public class FinallyDemo {

    int no1,no2;
    public FinallyDemo(String[] args) {

        try{
            no1=Integer.parseInt(args[0]);
            no2=Integer.parseInt(args[1]);
            System.out.println("相除结果结果为:"+no1/no2);
        }catch(ArithmeticException e1){
            System.out.println("除数不能为0");
        }catch (NumberFormatException e2) {

            System.out.println("必须输入数字");
        }finally{
            System.out.println("Finally 已执行,用于做清理");
        }
    }
    public static void main(String[] args) {
        new FinallyDemo(args);
    }
}

 

finally 语句

原文:http://www.cnblogs.com/superxuezhazha/p/5722344.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!