Regarding local variables in Java
<p>I have a quick question regarding local variables in Java:</p>

<p>If, upon declaring a local variable, I point it at an instance variable, does the local variable then act as a reference to that instance variable, or does act like a temporary deep copy?</p>

<p>In other words, if I invoke a modifier method on the newly initialized local variable, will the local variable act as a reference and invoke the modifier on the instance variable, will it modify a copied version pointed to by the local variable, or can modifier methods not be invoked on local variables?</p>

<p>Eg. </p>

<p>public static > boolean isSorted(Stack s) {</p>

<p>...(bunch of code)</p>

<p>else if(s instanceof DynamicArrayStack)
{
...(bunch of code)</p>

<p>DynamicArrayStack tempStack = (DynamicArrayStack) s;
E elem = (E) tempStack.pop();</p>

<p>...(bunch of code)
}
...(bunch of code)
}</p>

<p>Will invoking pop() on 'tempStack' cause pop() to be invoked on the instance of Stack pointed to by the parameter 's' as well? Or will it just affect the contents of my 'tempStack'?</p>
