[Solved] How to return object from ArrayList with parameter matching a field?


You are using the class name instead of the variable name in your method. If you switch your loop to:

Book found = null;
    for (Book book : Book.BookList)
      {
                    if (selection.equals(book.getBookTitle()))
                    {
                       found =  book;
                    }
      }
return found;

Try this out, it should fix your problem.

3

solved How to return object from ArrayList with parameter matching a field?