Altering variable in a method
<pre><code>private int myInt;

public var(int a)
myInt = a;

var x = new var(1)
var y = new var(5)
var z = y;
x = increment(y)     // where the increment method increments y by 1.
</code></pre>

<p>If the increment method alters the value of y, is the value of z also changed? In my book, when y is altered, z is also altered, but, how is that possible if z was already assigned to y before the increment method was called? Also I don't understand why x has anything assigned to it after the method. I thought that the scope of the method stays within the method; therefore after increment(y) exits, the value of x remains unchanged.</p>

<p>Please correct me if I am wrong because I am fairly new to programming.</p>

<p>Thank You!</p>
