A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

© 18895700133 中级黑马   /  2016-5-5 18:07  /  263 人查看  /  0 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文



public class Foo{
  public static void main(String args[]){
  try{return;}
   finally{ System.out.println("Finally");}
   }
    }

what is the result?
A. print out nothing
B. print out "Finally"
C. compile error
Answer:B   java的finally块会在return之前执行,无论是否抛出异常且一定执行

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马