求助一下equals问题
package yichang;
import java.util.Scanner;
import java.util.Arrays;
public class Library2 {
public void show() throws CommondException,NotfoundException{
Scanner input=new Scanner(System.in);
Book book=new Book(new String[][]{
{"1","唐诗三百首","T300"},
{"2","十万个为什么","S1000"},
{"3","三体","S3"},
{"4","java教程","J100"}});
System.out.println("******************欢迎来到图书管理系统!*******************");
System.out.println("*****输入命令:1-按照序号查找图书;2-按照名称查找图书*****");
int i1=input.nextInt();
if(i1==1) {
System.out.println("请输入图书序号:");
int i2=input.nextInt();
if(i2<1||i2>4) {
throw new NotfoundException("图书不存在,请重新输入!");
}else {
System.out.println("序号:"+book.book[i2-1][0]+"\t"+"名称:"+book.book[i2-1][1]+"\t"+"编码:"+book.book[i2-1][2]);
}
}else if(i1==2){
System.out.println("请输入图书名称:");
String name=input.next();
int a=0;
for(int i=0;i<3;i++) {
if(name.equals(book.book[i][1]) ){
System.out.println("序号:"+book.book[i][0]+"\t"+"名称:"+book.book[i][1]+"\t"+"编码:"+book.book[i][2]);
a=1;
break;
}
}
if(a==0) {
throw new NotfoundException("图书不存在,请重新输入!");
}
}
}
public static void main(String[] args) {
// TODO 自动生成的方法存根
Library2 kk=new Library2();
try {
kk.show();
}catch(NotfoundException e) {
e.printStackTrace();
}catch(CommondException e) {
e.printStackTrace();
}
}
}