Quantcast
Channel: Book program with arrayList - Code Review Stack Exchange
Browsing latest articles
Browse All 6 View Live

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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article

Answer 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 Article


Book 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
Browsing latest articles
Browse All 6 View Live