为什么跳不入rentway1()的catch中。
package com.imooc;
import java.util.Scanner;
public class library {
public static void main(String[] args) {
library bo=new library();
bo.book();
}
public void book(){
System.out.println("欢迎来到图书馆借书系统!");
System.out.println("请输入命令:1.按照名称查找图书。2.按照序列号查找图书");
try{
Scanner k=new Scanner(System.in);
int one=k.nextInt();
switch(one){
case 1:
rentway1();
break;
case 2:
rentway2();
break;
default:
System.out.println("你输入的结果有误");
}
}catch(Exception e){
System.out.println("请输入正确数值");
book();
}}
public void rentway1(){
String[] names={"数学","语文","英语","物理","化学","生物"};
System.out.println("欢迎来到图书馆名称查找系统");
Scanner k1=new Scanner(System.in);
String two=k1.next();
try{
switch(two){
case"数学":
System.out.println("你的图书已找到:"+two);
break;
case"语文":
System.out.println("你的图书已找到:"+two);
break;
case"英语":
System.out.println("你的图书已找到:"+two);
break;
case"化学":
System.out.println("你的图书已找到:"+two);
break;
case"物理":
System.out.println("你的图书已找到:"+two);
break;
case"生物":
System.out.println("你的图书已找到:"+two);
break;
default:
System.out.println("你的图书找不到");
}
}catch(RuntimeException e){
System.out.println("你输入有误!");
book();
}
}
public void rentway2(){
String[] names={"数学","语文","英语","物理","化学","生物"};
System.out.println("欢迎来到图书馆序列号查找系统");
try{
Scanner k3=new Scanner(System.in);
int three=k3.nextInt();
System.out.println("你输入的书籍为:"+names[three-1]);
}catch(Exception e){
System.out.println("你输入有误!");
book();
}
}
}