title: working around a null element in an array
body: <p>In my program, i "deleted" an element by turning it into a null as you can't delete an element from an array so <code>employee [i] = null</code>. However, I was wondering, if I wanted to work with the array that had a null element, like add all the numbers in the array, how do I do this without any problems?</p>
  
  <p>[<strong>UPDATE:</strong>]</p>
  
  <p>My array contains the first names, last names and ages of 4 employees, I've "deleted" one of the employees details by making it null. As per all of the suggestions I got, I tried to add all the ages using:</p>
  
  <pre><code>int sum = 0;
  
  for (int i = 0; i &lt; employee.length; i++) {
      if (employee[i] != null)
          sum += employee[i].getAge();
  }
  </code></pre>
  
  <p>but all I get is that sum = 1.</p>