I am trying part two in this assignment http://ocw.csail.mit.edu/f/14 I am on the part where I have to make a method to add books to the library and I have a method which should would but the problem I am having is the the way the parameter is passed to addBook is like this addBook(new Book("The Davinci Code")) So it is of type Book not string and when I try to print out the array of books I am getting @234bh23 <--not this exactly but you get the idea. public void addBook(Book Title){ if (Title != null && numBooks <7){ Books[numBooks] = Title; numBooks++; System.out.println(B
A large part of your problem is that your not keeping Book and Library separate. Creating a book is separate from adding that book to the Library collection.
Thanks I found the solution on a forum. I had to override the toString method.
Join our real-time social learning platform and learn together with your friends!