title: Java: resize method, can someone explain?
body: <p>I am not sure how this method works. What I understand is that we create an temporary array with double the size of the <code>theItems.length</code> (theItems is another array). After, we copy the items to the temp array and in the end we write theItems = temp; (I am not sure why and what happens)(does it mean that theItems double its size too?). Can't we double the size of theItems without using temp? </p>
  
  <pre><code>private void resize() {
      String[] temp = new String[theItems.length*2];
      for (int i=0 ; i &lt; noOfItems ; i++){
          temp[i]=theItems[i];
      }
      theItems=temp;
  }
  </code></pre>