title: recursive graphics function to draw circles
body: <p>I wanted to start creating fractals, which I think are fascinating.
  But I cant get the following code to work. </p>
  
  <pre><code>void drawcircle(int x, int y, int radius) {
      g.drawOval(x,y, radius,radius);   //g is to call the graphic functions
      if(radius&gt;2)
      {
         radius=radius/2;
         drawcircle(x, y, radius);
      }    
  }
  </code></pre>
  
  <p>Its supposed to give concentric circles, but theres just not output at all. Even a wrong output would work, as it'd allow me to fix it, but just nothing comes up in the frame. In the output window, it shows a huge block of red lines, but I dont understand what the error is. Can someone point me to the error?
  It'd be much appreciated.
  Edit : The code is used as follows. The code dosen't actually work for these values on my system, but it dosen't work for any other values either.</p>
  
  <pre><code> int x=0; int y=0;
      drawcircle(x,y,256);
  </code></pre>
  
  <p>This is the error I'm getting :</p>
  
  <p><img src="https://i.stack.imgur.com/JgB4h.png" alt="Error in the output window"></p>
  
  <p>Edit : Thanks to all the comments, I figured out the issue with the code. The correct code is</p>
  
  <pre><code>void conccircle(int x,int y, int radius,Graphics G) {
      G.drawOval(x-radius,y-radius,radius*2,radius*2);
      if(radius&gt;=2)
      {
          radius=radius/2;
          conccircle(x,y,radius,G);
      }
  }
  </code></pre>