title: Why doesn't Java forkbomb cause a StackOverflowError?
body: <p>I am new to programming, and I'm trying to teach myself what a StackOverflow is caused by. I played around with loops and caused the error, but a code for a forkbomb I tested doesn't cause the error. Why is this?</p>
  
  <pre><code>public class ForkBomb
  {
    public static void main(String[] args) throws java.io.IOException 
    {
       while(true) 
      {
          Runtime.getRuntime().exec(new String[]{"java", "-cp", System.getProperty("java.class.path"), "ForkBomb"});
      }
    }
  }
  </code></pre>
  
  <p>This doesn't cause a stack overflow. Why? Yet this causes one:</p>
  
  <pre><code>public class WhileBomb
  {
     public WhileBomb()
     {
        while (true)
        {
        new WhileBomb();
        }
     }
  
     public static void main(String[] args) throws java.io.IOException
     {
       WhileBomb goodBye = new WhileBomb();
     }
  }
  </code></pre>