一道99%的人会答错的面试题

来源:互联网 发布:nginx plus 和 nginx 编辑:程序博客网 时间:2024/05/23 02:02

相信大家对异常有了基本的认识了,下面来做一道有意思的面试题:


public class TestA {

    @SuppressWarnings("finally")

public  int  myMothod(int a,int b) {

    try {

    int m =a/b;

            return 1;

} catch (Exception e) {

System.out.println("抛出异常");

e.printStackTrace();

return 2;

}

finally{

return 3;

}

}

public static void main(String[] args) {

TestA a =new TestA();

int i=a.myMothod(2, 1);

System.out.println(i);

}

}



请问,输出结果是多少?

往下看:答案是:3


ps:有这么一群程序员,想做点什么,提供专业的技术文章,视频讲解,这是我们要做的事。用一秒的时间去关注一下,也许你会收获很多。

关注方式:

(1)打开手机微信客户端,通过“添加朋友→查找公众号→搜索‘码农搬砖’

(2)发现→扫一扫→扫描二维码,即可关注码农搬砖”官方微信公众账号。


1 0