title: Java: array of objects, two different approaches of initialization
body: <p>I'm currently experimenting with initializing an array of objects, and came across the following two approaches of filling the array of objects:</p>
  <p>Approach 1</p>
  <pre><code>Cat[] catArray = new Cat[num]
   
  for (int i = 0; i &lt; num; i++) {
      Cat someCat = new Cat();
      catArray[i] = someCat;
  }
  </code></pre>
  <p>Approach 2</p>
  <pre><code>Cat[] catArray = new Cat[num]
   
  for (int i = 0; i &lt; num; i++) {
      catArray[i] = new Cat();
  }
  </code></pre>
  <p>Is there any tangible difference in the above two ways of initializing and filling an array of objects in terms of memory usage and/or performance?</p>