正确代码:public int test2(){ int result = 100; try{ int divider = 10 ; //int result = 100; while(divider>-1){ divider--; result = result + 100/divider; } return result; }catch(Exception e){ e.printStackTrace(); System.out.println("循环抛出异常了!!!"); return 999; }finally{ System.out.println("我是finally!! 哈哈!!~"); System.out.println("我是 result ! 我的值为:" + result); } }错误代码:public int test2(){ //int result = 100; try{ int divider = 10 ; int result = 100; while(divider>-1){ divider--; result = result + 100/divider; } return result; }catch(Exception e){ e.printStackTrace(); System.out.println("循环抛出异常了!!!"); return 999; }finally{ System.out.println("我是finally!! 哈哈!!~"); System.out.println("我是 result ! 我的值为:" + result);//此处result说是不可处理变量这是为什么??? } }
添加回答
举报
0/150
提交
取消