try using a try/catch statement here:




if (books[i].getStatus() == null){
System.out.println("Status: Available");
}else{
System.out.println("Return date: " + books[i].getReturnDate());
}