I see a couple of issues here:

public Book[] arr = new Book[countElements]; You creating your array of 0 length here. Initializing should be done in the constructor like this

public...