请问我这个什么出现问题了!!求助,是返回值吗?
package com.imooc.test;
public class TryCatchTest {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
TryCatchTest tct=new TryCatchTest();
// int result=tct.test();
//System.out.println("test()方法y已经执行范围值为:"+result);
// int result2=tct.test2();
int result=tct.test3();
System.out.println("test3执行完毕!!完成返回值为:"+result);
}
public int test(){
int divider=10;
int result=100;
try{
while(divider>-1){
divider--;
result=result+100/divider;
}
return result;
}
catch(Exception e){
e.printStackTrace();
System.out.println("循环出异常了!!!");
return -1;
}
}
public int test2(){
int divider=10;
int result=100;
try{
while(divider>-1){
divider--;
result=result+100/divider;
}
return result;
}
catch(Exception e){
e.printStackTrace();
System.out.println("循环出异常了!!!");
return result=999;
}finally{
System.out.println("这是finally!!xixi");
System.out.println("我是result!!我的值是"+result);
}
}
public int test3(){
int divider=10;
int result=100;
try{
while(divider>-1){
divider--;
result=result+100/divider;
}
}
catch(Exception e){
e.printStackTrace();
System.out.println("循环出异常了!!!");
}finally{
System.out.println("这是finally!!xixi");
System.out.println("我是result!!我的值是"+result);
}
System.out.println("test3运行完了");
}
}