package CAR;public class Test { public ?int test() { int a=10;//除數 int b=100;//結果 try{ while(a>-1){ a--; b=b+100/a; } } catch(Exception e){ System.out.println("程序出現異常啦?。?!"); ? ?return 555;//我在catch語句中說明了了方法的會返回值 }//這里我刪除了方法的返回值 /*finally{ System.out.println("!?。?); }*/ } public static void main(String[] args) { Test one=new Test(); int sum=one.test(); System.out.println("哦"+"\t"+sum); }}請問為什么還是會報錯,我在刪除了方法的返回值但是我在catch中說明了方法的返回值,提示是方法應該有一個int的返回值類型。/
添加回答
舉報
0/150
提交
取消