title: Java - Understanding Recursion
body: <p>Can someone please explain to me why this prints out 1 2 3 4 5? I figured it would print out 4 3 2 1 0 but my book and eclipse both say I'm wrong. </p>
  
  <pre><code>public class whatever {
  
      /**
       * @param args
       */
      public static void main(String[] args) {
          xMethod(5);
  
      }
  
      public static void xMethod(int n){
          if (n&gt;0){
              xMethod(n-1);
              System.out.print(n + " ");
          }
      }
  
  
  }
  </code></pre>