首页 > 编程语言 > 详细

java面试

时间:2016-05-14 18:37:22      阅读:138      评论: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
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!