- //题目一
- public class TryCatch {
- public static void main(String[] args) {
- System.out.println("main "+new TryCatch().test());
- }
-
- public int test(){
- int i = 1;
- try
- {
- i = 55555;
- return i;
- } catch(Exception e) {
- return i;
- }
-
- finally
- {
- i = 1000;
-
-
- }
- }
- }
复制代码- //题目二
- public class TryCatch {
- public static void main(String[] args) {
- System.out.println("main "+new TryCatch().test());
- }
-
- public int test(){
- int i = 1;
- try
- {
- i = 55555;
- return i;
- } catch(Exception e) {
- return i;
- }
-
- finally
- {
- i = 1000;
- return i;
-
-
- }
- }
- }
- //尝试一下一眼看过去 你认为的答案是什么,然后运行验证一下
复制代码 |