Java and references
<p>I have basic class :</p>

<pre><code> public class SomeClass {

    private List&lt;String&gt; list = new ArrayList&lt;String&gt;();

    public List&lt;String&gt; getList() {
        return list;
    }

    public void setList(List&lt;String&gt; list) {
        this.list = list;
    }   

}
</code></pre>

<p>In a method I have this code :</p>

<pre><code>private void test(){

    SomeClass sc1 = new SomeClass();
    sc1.getList().add("a");
    sc1.getList().add("b");

    SomeClass sc2 = sc1;

    System.out.println(sc2.getList().size());

    sc1.getList().remove(0);
    System.out.println(sc2.getList().size());

    sc1=null;
    System.out.println(sc2.getList().size());

    sc2=null;
    System.out.println(sc2.getList().size());


}
</code></pre>

<p>I receive :</p>

<ul>
<li>2</li>
<li>1</li>
<li>1</li>
<li>NullPointerException</li>
</ul>

<p>but I though I would received :</p>

<ul>
<li>2</li>
<li>1</li>
<li>NullPointerException</li>
<li>NullPointerException (if previous NullPointerException caught)</li>
</ul>

<p>If a referenced object is set to <code>null</code>, the reference link is broken ? Thank you for clarifications</p>
