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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

homework

package?imooc_class;

import?java.util.InputMismatchException;
import?java.util.Scanner;

public?class?Imooc_1_07s_homework?{

????public?static?int?inputCheck(){
????????Scanner?scan?=?new?Scanner(System.in);
????????try{
????????????int?input?=?scan.nextInt();
????????????return?input;?//若上一行代碼未報(bào)錯(cuò)則返回輸入值
????????}catch(Exception?e)?{
????????????scan.next();?//讀取輸入內(nèi)容防止影響下次循環(huán)
????????????return?3;
????????}?finally?{
????????????System.out.println("finally");
????????}
????}

????public?static?void?main(String[]?args)?throws?Exception?{
????????Imooc_1_07s_book[]?books?=?{
????????????????new?Imooc_1_07s_book("論語",1),
????????????????new?Imooc_1_07s_book("高數(shù)",2),
????????????????new?Imooc_1_07s_book("電路",3),
????????????????new?Imooc_1_07s_book("大英",4)
????????};

????????System.out.println("--------圖書系統(tǒng)--------");

????????while?(true)?{
????????????System.out.println("輸入命令:1-按名稱查書(string);?2-按序號(hào)查書(int)");
????????????Scanner?scan?=?new?Scanner(System.in);

????????????int?userNum?=?inputCheck();

????????????boolean?exit?=?false;
????????????switch?(userNum)?{
????????????????case?1:
????????????????????System.out.print("Input?book?name:");
????????????????????String?searchName?=?scan.next();
????????????????????for(Imooc_1_07s_book?bookData?:?books){
????????????????????????boolean?i?=?searchName.equals(bookData.name);
????????????????????????if(i)?{
????????????????????????????System.out.println("已找到《"?+?bookData.name?+?"》,編號(hào):"?+?bookData.id);
????????????????????????????exit?=?true;
????????????????????????}
????????????????????}
????????????????????if(!exit){
????????????????????????System.out.println("sorry,?no?fund");
????????????????????}
????????????????????break;
????????????????case?2:
????????????????????System.out.print("Input?book?int:");
????????????????????int?searchInt?=?scan.nextInt();
????????????????????for(Imooc_1_07s_book?bookData?:?books){
????????????????????????if(searchInt?==?bookData.id)?{
????????????????????????????System.out.println("已找到《"?+?bookData.name?+?"》,編號(hào):"?+?bookData.id);
????????????????????????//??exit?=?true;
????????????????????????}
????????????????????}
????????????????????if(!exit){
????????????????????????System.out.println("sorry,?no?fund");
????????????????????}
????????????????????break;
????????????????default:
????????????????//??throw?new?RuntimeException("你眼瞎啊,輸入數(shù)字1或2,請(qǐng)重新輸入!");
????????????????????System.out.println("你眼瞎啊,輸入數(shù)字1或2,請(qǐng)重新輸入!");
????????????????????break;
????????????}
????????????if(exit){
????????????????break;
????????????}
????????}

????}

}


正在回答

1 回答

?

boolean?exit?=?false;

if(i)?{?System.out.println("已找到《"?+?bookData.name?+?"》,編號(hào):"?+?bookData.id);?

?exit?=?true;}? ? ? ? ? ? ? ? ? ? ?

if(!exit){?System.out.println("sorry,?no?fund");?}

!exit 是非真還是非假?

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消
Java入門第三季
  • 參與學(xué)習(xí)       409768    人
  • 解答問題       4502    個(gè)

Java中你必須懂得常用技能,不容錯(cuò)過的精彩,快來加入吧

進(jìn)入課程
微信客服

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

幫助反饋 APP下載

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

公眾號(hào)

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