java面试

 1 public class tests {
 2     
 3     public static void main(String[] args) {
 4         System.out.println(test());
 5     }
 6 
 7     private static int test() {
 8         
 9         int b = 10;
10         try{
11             System.out.println("try:");
12             return b+=20;
13         }catch(Exception e){
14             System.out.println("error:"+e);
15         }finally{
16             if(b>10) {
17                 System.out.println("b="+b);
18             }
19             System.out.println("finally:");
20             b=100;
21         }
22         
23         return b;
24     }
25 
26 }

求运行结果?

1、try:
2、b=30
3、finally:
4、30

原文地址:https://www.cnblogs.com/UniqueColor/p/5492863.html