title: What do you put for a Object Array Identifier when creating an element of the object?
body: <p>Imagine an array of objects.</p>
  
  <pre><code>int MAX_ALLOWED = 5;
  Object [] object = new Object [MAX_ALLOWED];
  </code></pre>
  
  <p><em>Suppose the object was a unit for a game with its respective location.</em> When the user presses a button called <em>"spawn unit"</em> the code will be:</p>
  
  <pre><code> unit [] = new Object (location);
  </code></pre>
  
  <p>As you can see there is no identifier in the <strong>[ _ ]</strong> so this presents the problem. I don't know what to put in here.If I put 0 it will over-ride the memory of the object at 0 every-time I create an object.</p>
  
  <p>When accessing a particular object or unit.</p>
  
  <pre><code>for (int i = 0; i &lt;= unit.length; i++)
      {
      if (location = unit [i].get_Location)
      {
          move (unit [i]);
          }
      }
  </code></pre>
  
  <p>But doing this will give me a null-pointer exception if I access an element after 0.</p>