I've created a small program where I have an array of 100 strings (null unless value added using another function).
If I am trying to issue a book that is not in the array, it is giving me NullPointerException error, instead of not running the if statement and printing that book isn't found.
public void issueBook() {
    Scanner sc = new Scanner(System.in);
    System.out.print("Enter book title to issue: ");
    String BookTitle = sc.nextLine();           //Asks for book name to be compared in the array
    for (int i = 0; i < Books.length; i++) {    //loop to check
        if (this.Books[i].equals(BookTitle)) {  //if statement to check the condition
            System.out.println("Book has been issued.");
            this.Books[i] = null; //If the book has been issued, it will null it's position in the array
            return;
            }
        }
        System.out.println("ERROR: Book not found.");   //If the book isn't found, it should print this
    }
 
     
     
    