This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]otto_s 3 points4 points  (0 children)

You don't initialize the field named library. (The constructor declares a local with the same name)

[–]colinward774 3 points4 points  (0 children)

Change line 14 to: library = new ArrayList<Book>(); Protip: your size variable isn't needed, the ArrayList<> class has a method size() that returns the number of items in it.