try catch的语法输出结果

public static int exception(){

        try{

            int a = 1 /1;

            return 1;

        }catch (Exception e){

            return 2;

        }finally {

            return 3;

        }

}


tuoguozhen
浏览 1175回答 1
1回答

望远

不管是否发生异常finally语句块都会被执行,最后返回值为3
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java