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

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么我在使用圖書名稱查找方法的時候,在控制臺輸入不進去名稱??? 急急急

為什么我在使用圖書名稱查找方法的時候,在控制臺輸入不進去名稱啊? 急急急

Destiny命運 2016-08-02 10:28:14
代碼:package com.BorrowBooks;//import java.awt.print.Book;import java.util.Scanner;public class book {??@SuppressWarnings("resource")??public static void main(String[] args){???for(;;){???System.out.println("歡迎使用借書系統(tǒng)");???System.out.println("輸入命令:1.按名稱查找圖書?? 2.按序號查找圖書");???Scanner in=new Scanner(System.in);???int choice = 3;//???int i= 0;//???int j = 0;//???String[] Book = {"高數(shù)","線代","概率論與數(shù)理統(tǒng)計","大學英語","數(shù)據(jù)庫","操作系統(tǒng)","java面向?qū)ο?};???try{????choice = in.nextInt();???}catch(Exception e){????System.out.println("命令輸入錯誤,請根據(jù)提示輸入整形的數(shù)字");????continue;???}???if(choice == 1){//????System.out.println("請輸入你要借的書的名稱");//????for(i=0;i<Book.length;i++){//????try{//?????? ?in.nextLine().equals(Book[i]);//???????System.out.println("Book:"+Book[i]);//???????break;//????}catch(Exception e){//?????System.out.println("圖書不存在");//?????continue;//????}//????}//???System.out.println("Book:"+Book[i]);????book Mc = new book();????Mc.find1();???}else if(choice == 2){//????System.out.println("請輸入你要借的書的序號");//????for(j=0;j<Book.length;j++){//????try{//?????? j=in.nextInt();//?????System.out.println("Book:"+Book[j]);//?????break;//????}catch(Exception e){//?????System.out.println("圖書不存在");//?????continue;//????}//????}//????System.out.println("Book:"+Book[j]);????book Xh = new book();????Xh.find2();???}else {????System.out.println("你的選擇錯誤");???}??}??}??@SuppressWarnings("resource")??public void find1(){???int i = 0;???String[] Book = {"高數(shù)","線代","概率論與數(shù)理統(tǒng)計","大學英語","數(shù)據(jù)庫","操作系統(tǒng)","java面向?qū)ο?};???System.out.println("請輸入你要借的書的名稱");???Scanner in=new Scanner(System.in);???for(i=0;i<Book.length;i++){???try{????? ?in.nextLine().equals(Book[i]);??????System.out.println("Book:"+Book[i]);??????break;???}catch(Exception e){????System.out.println("圖書不存在");????continue;???}???}??}??@SuppressWarnings("resource")??public void find2(){???int j = 0;???String[] Book = {"高數(shù)","線代","概率論與數(shù)理統(tǒng)計","大學英語","數(shù)據(jù)庫","操作系統(tǒng)","java面向?qū)ο?};???System.out.println("請輸入你要借的書的序號");???Scanner in=new Scanner(System.in);???for(j=0;j<Book.length;j++){???try{????? j=in.nextInt();????System.out.println("Book:"+Book[j]);????break;???}catch(Exception e){????System.out.println("圖書不存在");????continue;???}???}??}?}
查看完整描述

2 回答

  • 2 回答
  • 1 關(guān)注
  • 1519 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

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