package com.exception;public class ExceptionTest { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Book[] book={new Book(1,"高數"),new Book(2,"論語"),new Book(3,"英語"),new Book(4,"編程"),new Book(5,"語文")}; BookAdmin ba=new BookAdmin(); int command=ba.inputCommand(); while(true){ System.out.println("輸入命令:1-按照名稱查找圖書;2-按照序號查找圖書"); try{ switch(command){ case 1: String book1=ba.getBookByName(book); System.out.println("book:"+book1); break; case 2: String book2=ba.getBookByName(book); System.out.println("book:"+book2); break; case -1: System.out.println("命令輸入錯誤!請根據提示輸入數字命令!"); continue; default: System.out.println("命令輸入錯誤!"); continue; } }catch(Exception e){ System.out.println(e.getMessage()); } } }}哪位大神幫忙看看怎么運行的時候啥輸出都沒有。調用方法寫在另一個類里了,程序也沒報錯。跪求大神指導
添加回答
舉報
0/150
提交
取消