码迷,mamicode.com
首页 > 编程语言 > 详细

java面试

时间:2016-05-14 18:39:36      阅读:122      评论:0      收藏:0      [点我收藏+]

标签:

 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

 

java面试

标签:

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!