最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

第三個(gè)catch結(jié)構(gòu)為啥不能使用Exception

第三個(gè)catch結(jié)構(gòu)為啥不能使用Exception

愛(ài)西瓜同志 2018-10-21 21:55:19
//定義一個(gè)接收兩數(shù)商的方法,從鍵盤輸入 public static int quotient() { Scanner ss = new Scanner(System.in); System.out.println("========運(yùn)算開始========"); try { System.out.println("請(qǐng)輸入第一個(gè)數(shù):"); int x = ss.nextInt(); System.out.println("請(qǐng)輸入第二個(gè)數(shù):"); int y = ss.nextInt(); return x / y; }catch(ArithmeticException a) { System.out.println("除數(shù)不能為0!"); return 0; }catch(InputMismatchException i) { System.out.println("請(qǐng)輸入一個(gè)整數(shù)!"); return 1000000; }catch(Exception e) { System.out.println("程序出錯(cuò)了!"); }finally { System.out.println("========運(yùn)算結(jié)束========"); } }
查看完整描述

1 回答

?
Caballarii

TA貢獻(xiàn)1123條經(jīng)驗(yàn) 獲得超629個(gè)贊

第三個(gè)catch里把return加上或者在final里return就行了

查看完整回答
1 反對(duì) 回復(fù) 2018-10-23
  • 1 回答
  • 0 關(guān)注
  • 989 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)