package try_catch;
import java.util.Scanner;
public class TryCatchPractice2 {
//在类开始声明,则其他方法都能调用
Scanner in=new Scanner(System.in);
NoBookException NoB=new NoBookException();
String[] books={"语文","数学","英语"};
static TryCatchPractice2 trycat=new TryCatchPractice2();
//主函数
public static void main(String[]args) throws Exception{trycat.InputClassException();
}
//命令错误
public void InputClassException()throws Exception{
try{
System.out.println("欢迎光临本图书管理系统");
System.out.println("1.书名查询。2.序号查询");
int a=in.nextInt();
switch(a){
case 1://查找图书
trycat.findBooks();
break;
case 2://查找序号
trycat.findBooksNum();
break;
default:
throw new NoBookException("错误命令,请输入整数1