异常补充

发布时间:2022-06-26 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了异常补充脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
package itheima_05;public class Demo02 {    public static void main(String[] args) {        int a=1;        int b=0;        test(a,b);    }    public static void test(int a,int b){  //try catch的作用:捕获异常,打印异常,出现异常对异常进行处理,继续向下面执行        try {            System.out.println(a/b);        } catch (Exception e) {            e.printStackTrace();            System.out.println("这是异常");        } finally {        }        System.out.println("1");    }//    public static void main(String[] args) throws Exception{ //throws关键字的作用:抛出异常,在哪抛出,程序就在哪结束//        int a=1;//        int b=0;//        test(a,b);//    }//    public static void test(int a,int b){//        System.out.println(a/b);//    }}

脚本宝典总结

以上是脚本宝典为你收集整理的异常补充全部内容,希望文章能够帮你解决异常补充所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。
标签: