Q:

Does member variable still in the buffer when recursion function gets call?

I am trying to understand whether the member variable still in the buffer or not when recursion function gets call each time.
here is my code:
 public static int gcd(int m,int n)
{

    System.out.println("Entering 'gcd' method:  m= "+m+",  n="+n);
    if(m%n==0)
    {         
       System.out.println("Returning 'gcd' value ="+n+" (Base case:      m=)"+m+",  n="+n );    
        return n;
    }
    else          
    {

        int temp= gcd(n,m%n);
        System.out.println("Returning 'gcd' value ="+temp+" (recursive case:      m=)"+m+",  n="+n );

        return temp;

    }

I don't understand when I enter 843 99 
the System.out.println before return temp. will become reverse print out of M and N
for example:
enter two integers(or 'q' to exit):843 99
Entering 'gcd' method:  m= 843,  n=99
Entering 'gcd' method:  m= 99,  n=51
Entering 'gcd' method:  m= 51,  n=48
Entering 'gcd' method:  m= 48,  n=3
Returning 'gcd' value =3 (Base case:      m=)48,  n=3
Returning 'gcd' value =3 (recursive case:      m=)51,  n=48
Returning 'gcd' value =3 (recursive case:      m=)99,  n=51
Returning 'gcd' value =3 (recursive case:      m=)843,  n=99
The GCD of  843 and99 is 3

A:

This happens because the state of methods calls are stored on a stack (called the "call stack").
As you may know, a stack is a First In Last Out data structure. This means that If you push items A, B, C and D onto the stack in order, the first item you pop from the stack will be D, and the last item you pop would be A.
Whenever you call a method B from a method A, B gets pushed onto the call stack and sits on top of A. B will do its thing and when it returns, it gets popped from the stack and A will carry on with whatever it was doing.
Therefore, the first call to gcd will be popped last, and the last call will be popped first, with everything in between being reversed.
This behaviour can be "simulated" using a java.util.Stack:
Stack<String> stack = new Stack<>();
for(int i = 0 ; i < 5 ; i++) {
    // simulating calling gcd recursively
    String s = "Call #" + i + " of gcd";
    stack.push(s);
    System.out.println(s);
}

for (int i = 0 ; i < 5 ; i++) {
    // simulating returning from all the calls to gcd
    System.out.print("Returning from ");
    System.out.println(stack.pop());
}

And it prints:
Call #0 of gcd
Call #1 of gcd
Call #2 of gcd
Call #3 of gcd
Call #4 of gcd
Returning from Call #4 of gcd
Returning from Call #3 of gcd
Returning from Call #2 of gcd
Returning from Call #1 of gcd
Returning from Call #0 of gcd

