本帖最后由 一碗小米周 于 2014-1-4 13:30 编辑  
 
- public class Test4 {
 
 -         public static void main(String[] args) {
 
 -                 System.out.println(Test4.Ret());
 
 -         }
 
 -         public  static int Ret(){
 
 -                 int a=10;
 
 -                 try{
 
 -                         return a;
 
 -                 }
 
 -                 finally{
 
 -                         a=a+10;
 
 -                         System.out.println("s");
 
 -                 }
 
 -         }
 
 - }
 
 
  复制代码 我上网查了一下资料,当try中有return时,是先执行finally里的语句的,再执行try中的return。那么在finally中a会变成20,那么try中的return a 为什么没有改变呢?求高手详解呀。谢谢。 
 |