第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

為什么不能成功檢錯(cuò)?

為什么不能成功檢錯(cuò)?

慕虎7175789 2017-08-31 14:26:05
package?com.xesivo; import?java.util.Scanner; public?class?MSLibrary?{ static?int?consent1?=?0; static?int?consent2?=?0; static?int?imput?=?0; public?static?void?methSel()?throws?Exception{ Scanner?in?=?new?Scanner(System.in); int?a?=?in.nextInt(); if(a?!=?1){ if(a?!=?2){ Exception?e?=?new?Exception(); throw?e; } } imput?=?a; consent1?=?1; } public?static?void?numSe()?throws?Exception{ Scanner?in?=?new?Scanner(System.in); int?a?=?in.nextInt(); if(a?<?0){ Exception?e?=?new?Exception(); throw?e; } if(a?>?8){ Exception?e?=?new?Exception(); throw?e; } for(int?i?=?1;?i?<=?8;?i++){ if(i?==?a){ System.out.print("找到圖書(shū):"); switch(i){ case?1: System.out.println("孟子"); break; case?2: System.out.println("山海經(jīng)"); break; case?3: System.out.println("說(shuō)文解字"); break; case?4: System.out.println("一生最?lèi)?ài)唐詩(shī)"); break; case?5: System.out.println("一生最?lèi)?ài)宋詞"); break; case?6: System.out.println("丁丁歷險(xiǎn)記全英"); break; case?7: System.out.println("哈利波特全英"); break; case?8: System.out.println("英國(guó)學(xué)生文學(xué)讀本"); break; } } } consent2?=?1; } public?static?void?nameSe()?throws?Exception{ Scanner?in?=?new?Scanner(System.in); String?a?=?in.nextLine(); if(a?!=?"孟子"){ if(a?!=?"山海經(jīng)"){ if(a?!=?"說(shuō)文解字"){ if(a?!=?"一生最?lèi)?ài)唐詩(shī)"){ if(a?!=?"一生最?lèi)?ài)宋詞"){ if(a?!=?"丁丁歷險(xiǎn)記全英"){ if(a?!=?"哈利波特全英"){ if(a?!=?"英國(guó)學(xué)生文學(xué)讀本"){ Exception?e?=?new?Exception(); throw?e; } } } } } } } } int?b?=?0; switch(a){ case?"孟子": b?=?1; break; case?"山海經(jīng)": b?=?2; break; case?"說(shuō)文解字": b?=?3; break; case?"一生最?lèi)?ài)唐詩(shī)": b?=?4; break; case?"一生最?lèi)?ài)宋詞": b?=?5; break; case?"丁丁歷險(xiǎn)記全英": b?=?6; break; case?"哈利波特全英": b?=?7; break; case?"英國(guó)學(xué)生文學(xué)讀本": b?=?8; break; } for(int?i?=?1;?i?<=?8;?i++){ if(i?==?b){ System.out.print("找到圖書(shū):"); switch(i){ case?1: System.out.println("孟子"); break; case?2: System.out.println("山海經(jīng)"); break; case?3: System.out.println("說(shuō)文解字"); break; case?4: System.out.println("一生最?lèi)?ài)唐詩(shī)"); break; case?5: System.out.println("一生最?lèi)?ài)宋詞"); break; case?6: System.out.println("丁丁歷險(xiǎn)記全英"); break; case?7: System.out.println("哈利波特全英"); break; case?8: System.out.println("英國(guó)學(xué)生文學(xué)讀本"); break; } } } imput?=?b; consent2?=?1; } public?static?void?main(String[]?args)?{ System.out.println("歡迎來(lái)到小粟圖書(shū)館!"); System.out.println("按序號(hào)查找圖書(shū)請(qǐng)按1,按名稱(chēng)查找圖書(shū)請(qǐng)按2!"); while(consent1?==?0){ try{ ????methSel(); ????}catch(Exception?e){ ????System.out.println("輸入有誤,請(qǐng)重新輸入!"); ????} } if(imput?==?1){ System.out.println("請(qǐng)輸入序號(hào)!"); while(consent2?==?0){ try{ numSe(); }catch(Exception?e){ ????System.out.println("輸入有誤,請(qǐng)重新輸入!"); } } } if(imput?==?2){ System.out.println("請(qǐng)輸入名稱(chēng)!"); while(consent2?==?0){ try{ nameSe(); }catch(Exception?e){ System.out.println("輸入有誤,請(qǐng)重新輸入!"); } } } } }運(yùn)行結(jié)果是這樣的嚶嚶嚶為什么?
查看完整描述

1 回答

已采納
?
fatewa

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

字符串是否相等用equals函數(shù)
判斷條件
a != "孟子" 換成 !a.equals("孟子")

查看完整回答
1 反對(duì) 回復(fù) 2017-09-02
  • 1 回答
  • 0 關(guān)注
  • 1223 瀏覽
慕課專(zhuān)欄
更多

添加回答

舉報(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)