title: Java How can i add an element into my array?
body: <p>my constructor containing my array:</p>
  
  <pre><code>public Library(int maxNumberofTextBook)
  {
      // initialise instance variables
      nextBook = 0;
      numberOfBorrowers = 0;
      numberOfChapters = 6;
      bookShelf = new Textbook[maxNumberofTextBook + 1];
      for (int i = 0; i &lt; maxNumberofTextBook; i++)
          bookShelf[i] = new Textbook("Text book number" +i, numberOfChapters);
  }
  </code></pre>
  
  <p>in this method i want the array to take the parameter input and add it to the array above:</p>
  
  <pre><code>public void returnBook(Textbook book)
  {
      //add book into array//
      numberOfBorrowers -- ; 
      bookInShelf ++ ; 
  }
  </code></pre>