インデックスを返そうとするとエラー (int を返す必要があります) が発生します。何が間違っているのかわかりません。Object 配列のインデックスを int と比較し、インデックス番号を返すにはどうすればよいですか?
//x starts at 10000 because the left most number is assumed to be at least a 1.
/**
* Search for a book id within the Book object array
* @param Book - Array of objects with book id, title, isbn, author, and category
* @param numOfBooks - how many books are in the library
* @param myBookID - The key to search for
* @return the index of the array where the key matches
*/
public static int bookSearch (Object[] Book, int numOfBooks, int myBookID) {
for (int x = 10000; x <= numOfBooks; x ++)
if (Book[x].equals(myBookID))
return x;
}