So, basically I have a library system that has
    private int numberOfBooks = 0;
    public int getNumberOfBooks()
{
    return numberOfBooks;
}
Of course when you add a new book in the library the numberOfBooks is increased by 1. My other class Student has the following code:
    private LibrarySystem libraryBooks;
    public void searchByISBN()
{
    int i = 0;
    boolean found = false;
    while(i<libraryBooks.getNumberOfBooks()) //THE PROBLEM IS HERE
    {
        if(books[i].getISBN().equals(in.next()))
        {
            found = true;
            break;
        }
        i++;
    }
    if(found)
    {
        System.out.println("\n Book info: \n ISBN: " + books[i].getISBN() + 
                            "\n Title: " + books[i].getTitle() +
                            "\n Author: " + books[i].getAuthor() +
                            "\n Subject: " + books[i].getSubject());
                        }
       else System.out.println("There is no book with such ISBN");
}
I get a Java.lang.NullPointerException and I don't know why. How can I fix this?
 
    