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

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

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

import java.io.*;
public class Mine {
    public static void main(String argv[]){
         Mine m=new Mine();
         System.out.println(m.amethod());
    }
    public int amethod() {
         try {
             FileInputStream dis=
new FileInputStream("Hello.txt");
         }catch (FileNotFoundException fne) {
             System.out.println("No such file found");
             return -1;
         }catch(IOException ioe) {
         } finally{
             System.out.println("Doing finally");
         }
         return 0;
    }
}
A. No such file found
B. No such file found ,-1
C. No such file found, Doing finally, -1
D. 0

评分

参与人数 3黑马币 +7 收起 理由
niwota + 2 很给力!
wowowo + 3 很给力!
641846178 + 2 很给力!

查看全部评分

2 个回复

倒序浏览
我认为选C
先抛出异常,执行到return之前,再执行finally,再返回catch中的return
回复 使用道具 举报
zhanghongtuo 发表于 2016-5-31 18:15
我认为选C
先抛出异常,执行到return之前,再执行finally,再返回catch中的return

多谢啊{:2_30:}{:2{:2_36:}
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马