title: How does the recursion here work?
body: <p>Code 1: </p>
  
  <pre><code>public static int fibonacci (int n){ 
      if (n == 0 || n == 1) { 
          return 1; 
      } else { 
          return fibonacci (n-1) + fibonacci (n-2); 
      }        
  } 
  </code></pre>
  
  <p>How can you use <code>fibonacci</code> if you haven't gotten done explaining what it is yet? I've been able to understand using recursion in other cases like this: </p>
  
  <p>Code 2:</p>
  
  <pre><code>class two 
  {
      public static void two (int n) 
      {
          if (n&gt;0) 
          {
              System.out.println (n) ;
              two (n-1) ;
          }
          else
          {
              return ;
          }
      } 
  
      public static void main (String[] arg) 
      {
          two (12) ;
      }
  }
  </code></pre>
  
  <p>In the case of code 2, though, <code>n</code> will eventually reach a point at which it doesn't satisfy <code>n&gt;0</code> and the method will stop calling itself recursively. In the case of code 2, though, I don't see how it would be able to get itself from 1 if <code>n=1</code> was the starting point to 2 and 3 and 5 and so on. Also, I don't see how the line <code>return fibonacci (n-1) + fibonacci (n-2)</code> would work since <code>fibonacci (n-2)</code> has to contain in some sense <code>fibonacci (n-1)</code> in order to work, but it isn't there yet. </p>
  
  <p>The book I'm looking at says it will work. How does it work?</p>