title: Stack OverFlow with inherited JPanels
body: <p>So I'm writing a program that is fairly expansive and had a stack overflow error (No, I'm not using any kind of recursion, at least not directly.)  I tried to recreate the situation with much simpler classes to see if it would also cause a stack overflow error and it did.  Here they are:</p>
  
  <p>First Class:</p>
  
  <pre><code>public class Thing 
  {
      public static void main(String[] args) 
      {
            OtherThing thing = new OtherThing();
      }
  }
  </code></pre>
  
  <p>Second Class:</p>
  
  <pre><code>public class OtherThing extends JPanel
   {
       protected int s =5;
       protected String blah = "asfasd";
       public OtherThing()
       {
          OtherOtherThing thing2 = new OtherOtherThing();
       }
   }
  </code></pre>
  
  <p>Last Class:</p>
  
  <pre><code>public class OtherOtherThing extends OtherThing
   {
       public OtherOtherThing()
       {
  
       }
   }
  </code></pre>
  
  <p>This causes a stack overflow bouncing between OtherThing line 8 and OtherOtherThing line 4 (lines im sure are a little off now.)</p>
  
  <p>I know that you can inherit from a class that has inherited from something else, the Java API is full of them.  Whats wrong with this example? </p>