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());
}
}
}
}
哪位大神帮忙看看怎么运行的时候啥输出都没有。调用方法写在另一个类里了,程序也没报错。
跪求大神指导
慕姐4675099
ahdruid
相关分类