Spatial & Temporal dimensions of local & parameter variables

  1. The Spatial dimension of local & parameter variable scope:

    Example: two different variables x & y
          public class myClass
          {
             public void myMethod1(int x)     
    	 {
    	    ...
    	    ...
    	    BankAccount y;
    	    ...
    	    ....
    	 }
    
             public void myMethod2(int x)
    	 {
    	    ...
    	    ... 
    	    BankAccount y;
    	    ...
    	    ....
    	 }
    
          }
    

  2. The Temporal deimension of local & parameter variable scope:

    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 NEW set of variables "this", "x" & "y")
    	    ....
    	 }
          }
    

  3. Another example:

    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:

  4. DEMO program: Click here