Answer by Thomas Junk for Book program with arrayList
1) I know it is not your fault, but I strongly disagree with the specificationMethods: public Library(ArrayList other)Throws a NullPointerException if other is null. Otherwise, the Library’s Book...
View ArticleAnswer by 200_success for Book program with arrayList
I agree with everything said by @VoidOfUnreason and @RetailCoder, and won't bother repeating them. I'll just note that there are many careless bugs.In Library.add(), your if-condition is wrong. Also,...
View ArticleAnswer by palacsint for Book program with arrayList
Just a quick note (as far as I see nobody has mentioned yet):ArrayList<...> reference types should be simply List<...>. See: Effective Java, 2nd edition, Item 52: Refer to objects by their...
View ArticleAnswer by Mathieu Guindon for Book program with arrayList
I have never written a line of java code, but I'll give it a shot:public Library(ArrayList<Book> other) { if (other == null) { throw new NullPointerException("null pointer"); } else allBook =...
View ArticleAnswer by VoiceOfUnreason for Book program with arrayList
Your default constructor Library() initializes the allBook member variable twice, with the same value in each case. Probably not what you had in mind. The immediate fix is to remove the (re) assignment...
View ArticleBook program with arrayList
I have this Book program that contains 2 classes: Book and Library. I have the Book class done, but need some help on the Library class. Please help me check my code. I can provide the Book class if...
View Article