Example: two different variables x & y
public class myClass
{
public void myMethod1(int x)
{
...
...
BankAccount y;
...
....
}
public void myMethod2(int x)
{
...
...
BankAccount y;
...
....
}
}
|
|
Example: local & parameter variables created by different invocations
public class myClass
{
public void myMethod(int x)
{ (this)
...
...
BankAccount y;
...
....
}
}
public class myProgram
{
public static void main(String args[])
{
myClass a;
myClass b;
...
...
a.myMethod(4);
(creates variables "this", "x" & "y")
...
...
b.myMethod(9);
(creates a set of variables "this", "x" & "y")
....
}
}
|
public class TemporalDim
{
public static void TestFunc(int NNN)
{
if ( NNN == 3 )
return;
NNN = NNN + 1;
TestFunc(NNN);
}
public static void main(String argv[])
{
int k = 0;
TestFunc(k);
}
}
|
What happens when this program is run: