qq_力克_0
2016-10-27 20:00
public class TryCatchText {
public static void main(String[] args) {
TryCatchText tct =new TryCatchText();
int result =tct.text();
System.out.println("方法执行了"+result);
}
public int text(){
int diveder =10;
int result =100;
try{
while (diveder>-1){
diveder--;
result =diveder + result/10;
}
return result;
}catch(Exception e){
e.printStackTrace();
System.out.println("循环抛出异常了");
return -1;
}
}
}
自己刚才弄懂了。浪费了一次提问机会。呜呜
Java入门第三季
409792 学习 · 4340 问题
相似问题
回答 1