public class TryExer {
    public static void main(String[] args) {
        String test = test();
        System.out.printf("返回:"+test);
    }

    public static String test(){
        try {
            System.out.println("try");
            return "try";
        } catch (Exception e) {
            System.out.println("catch");
            e.printStackTrace();
        }
        finally {
            System.out.println("finally");
            return "finally";
        }
    }
}

 

posted on 2019-09-24 16:07  王洪洪  阅读(275)  评论(0编辑  收藏  举报