title: Should i set null to object for delete from memory?
body: <p>For example:</p>
  
  <pre><code>public class Box{
      public int id;
  
      public Box(int id){
          this.id = id;
      }
  }
  
  ArrayList&lt;Box&gt; boxArray = new ArrayList&lt;Box&gt;();
  
  boxArray.add(new Box(0));
  boxArray.add(new Box(1));
  boxArray.add(new Box(2));
  
  for (Iterator&lt;Box&gt; iter = boxArray.iterator(); iter.hasNext();) {
      Box box = iter.next();
  
      if (box.id == 1) {
          iter.remove();
          box = null;
      }
  }
  </code></pre>
  
  <p>I know that: In Java, the JM is delete object when no referance.</p>
  
  <p>But</p>
  
  <ol>
  <li>Should i set "box = null;" to object in this code after remove it from array or not?</li>
  <li>How can i make sure that the object will definitely remove from JM?</li>
  </ol>