Scope of variable when overloading methods
<p>For instance,</p>

<pre><code>class ClassOne{

int y = 3
int x = 2

void foo(){
--y;
}
void bar(){
y--;
}
void tesla(){
int y = 10;
}
}
</code></pre>

<p>As far as I understand, methods will change class variables in that way:</p>

<ol>
<li><code>foo()</code> will do nothing on either variables</li>
<li><code>bar()</code> will decrease y var by 1, so <code>y=2</code></li>
<li><code>tesla()</code> will create private or protected variable y which can be accessible only inside this <code>tesla()</code> method.</li>
</ol>

<p>I am not sure about third one, please comment, did I understand it right? </p>
