title: Recursion return values
body: <p>I've been studying recursion in java for the past few weeks. I've stepped through this method as it runs (using eclipse) though i'm a little confused as to what is actually happening. What I see is the else statement making the variable "n" decrement until 1 and then finally access the if statement (as expected). This is where I get lost. At this point I see the "n" variable increment from 1 to 5 (5 was my input when the method was called), repeatedly accessing the else statements return.</p>
  
  <p>Basically my question is why after returning 1 in the "if" statement does the code the jump to the else return ? Also, why after doing this does it execute 5 times instead of jumping out of the method ? </p>
  
  <p>I understand this is a basic concept for recursion but it's completely lost on me apparently</p>
  
  <pre><code>public static long getFactorial(long n) {
  
      if (n == 1){
          return 1;
      }
      else {
          return n * getFactorial(n-1);
      }
  </code></pre>