相信你們對異常有了基本的認識了,下面來作一道有意思的面試題:面試
public class TestA {app
@SuppressWarnings("finally")ide
public int myMothod(int a,int b) {spa
try {orm
int m =a/b;ci
return 1;it
} catch (Exception e) {io
System.out.println("拋出異常");class
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);
}
}