异常

下面代码的执行结果是  B

 1 public class Test {
 2      public static void main(String[] args) {
 3          System.out.println(see());
 4          System.out.println(see1());
 5     } 
 6      
 7     static boolean see(){
 8         try {
 9             return true;
10         } catch (Exception e) {
11             e.printStackTrace();
12         }finally{
13             return false;
14         }
15     }
16     
17     static boolean see1(){
18         try {
19             int a=1/0;
20         } catch (Exception e) {
21             return true;
22         }finally{
23             return false;
24         }
25     }
26      
27 }
28 
29 
30 A  true  true
31 B  flase   false
32 C  true   flase
33 D false   true
34 
35 finally  里面的一定会执行的。

 

posted @ 2018-10-23 22:47  雪落无痕1  阅读(81)  评论(0编辑  收藏  举报