Java outputs references : <p>I have a bit of a difficult time wrapping my head around this so I hope you guys can help me out here. Why does a[0] get replaced with 400 in this example here </p>

<pre><code>int [] a = {1, 2, 3 } ; 
int [] b = a ;
b[0] = 400 ;
System.out.println(a[0]);
</code></pre>

<p>while in the example here c remains 2? I just don't understand this. </p>

<pre><code>int c = 2 ; 
int d = c ;
d = 1 ; 
System.out.println(c);
</code></pre>

<p>A short explanation as to why this is happening would be very welcome. </p>
