We all have been using function call() in iterative ,recursive programs extensively.
When any parameterized function(param) is called then the parameterized fn() is pushed onto the stack.
When this parameterized fn() will be pushed onto the stack the parameter is repalced by the value it hold at that particular point of time.
This same logic will apply to any value which is pushed onto the stack memory.
** A basic program to demonstrate the same.
class Test {
public static void main (String[] args) {
System.out.println(fina());
}
public static int fina()
{
int x = 0;
try {
x = 1;
int a = 10/0;
}
catch (Exception e)
{
x = 2;
return x;
}
finally
{
x = 3;
}
return x;
}
}The value returned will be 2 .