java面试
2016-05-14 16:50
453 查看
public class tests { public static void main(String[] args) { System.out.println(test()); } private static int test() { int b = 10; try{ System.out.println("try:"); return b+=20; }catch(Exception e){ System.out.println("error:"+e); }finally{ if(b>10) { System.out.println("b="+b); } System.out.println("finally:"); b=100; } return b; } }
求运行结果?
1、try:
2、b=30
3、finally:
4、30