编译不通过????
package order;
import java.util.Iterator;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeMap;
public class book {
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
String s="1001高数-1002大学英语-1003电路分析-1004java";
TreeMap tp=new TreeMap();
String[] arr=s.split("-");
for(int i=0;i<arr.length;i++){
String[] arr1=arr[i].split(" ");
tp.put(arr1[0], arr1[1]);
}
while(true){
Set keySet=tp.keySet();
Iterator it=keySet.iterator();
System.out.println("请按下面要求输入:1.按图书编号查询\2.按图书的名字查询");
Scanner sc=new Scanner(System.in);
int k=sc.nextInt();
if(k==1){
System.out.println("请您输入图书编号:");
String str1=sc.next();
while(it.hasNext()){
Object key=it.next();
Object value=tp.get(key);
try{
if(key.equals(str1)){
System.out.println("所查的图书为:"+key+":"+value);
}
}catch(Exception e){
System.out.println("您输入的编号不对,请重新输入!!!!");
}
}
if(k==2){
System.out.println("请输入所需图书名称:");
String str2=sc.next();
while(it.hasNext()){
Object key=it.next();
Object value=tp.get(key);
try{
if(key.equals(str2)){
System.out.println("所查的图书为:"+key+":"+value);
}
}catch(Exception e){
System.out.println("您输入的图书名称不存在!!!!");
}
}
}
}
}
}
}