关于return的疑问,为何接收不到return所返回的值。
public class FunctionException {
public static void main(String[] args) {
FunctionException tt=new FunctionException();
tt.function();
int divisor=tt.function();
int Divisor=tt.function();
System.out.println("接收返还值Divisor"+Divisor);
System.out.println("接收返还值divisor"+divisor);
}
public int function() {
try {
int Divisor=100;
int divisor=3;
int JS;
do {
JS=Divisor/divisor;
divisor--;
} while (divisor>-1);
return Divisor;
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
System.out.println("出现了一个错误");
}
return -1;
}
}