title: StackOverflowError during recursive call
body: <p>The question is strictly theoretical but I couldn't find an answer. Consider this short program:</p>
  
  <pre><code>public class SBtst {
  
      int i = 0;
  
      public static void main(String[] args) {
          new SBtst().rec();
      }
  
      public void rec() {
          System.out.println("rec is called "+i++);
          try {
              rec();
          } catch (StackOverflowError soe) {
              System.out.println("completed "+soe.getStackTrace().length);
          }
      }
  
  }</code></pre>
  
  <p>After execution I get output similar to:</p>
  
  <pre><code>rec is called 10472
  rec is called 10473
  rec is called 10474Recursion completed 1024
  </code></pre>
  
  <p>The questions are:</p>
  
  <ol>
  <li><p>Why didn't println() completed new line because as I understand it, an error should be thrown when the next rec() call is executed and it is AFTER println() completed</p></li>
  <li><p>Why do I get only 1024 elements in the <code>stackTrace</code> array but <code>i</code> is equal to 10474? Does it mean that not every call is in the stack trace?</p></li>
  </ol>