请问大神问题在哪~
public static void BookName() throws Exception { try { String name = sc.next(); for (int i = 0; i < bookname.length; i++) { int num = i + 1; if (name.equals(bookname[i])) { System.out.println("******序号" + num + "." + name + "******"); break; } } throw new Exception("******nameException******"); } catch (Exception e) { System.out.println("******输入书名有误请重新输入******"); BookName(); } }
输入正确的书名时,结果显示正确。但为什么还会提示“******输入书名有误请重新输入******
”