title: Java keep printing a new line in my recursive method
body: <p>I am trying to write a recursive method to print n number of asteriks in a line and create a new line at the end. </p>
  
  <p>So, TriangleOps.line(5);</p>
  
  <p>would print</p>
  
  <pre><code>    *****
  </code></pre>
  
  <p>This is the code I wrote:</p>
  
  <pre><code>    public static void line (int n){
      if(n&gt;0){
      System.out.println("*");
      line(n-1);
      }}
  </code></pre>
  
  <p>instead it prints</p>
  
  <pre><code>    *
      *
      *
      *
      *
  </code></pre>
  
  <p>with a lot of space at the end. Can anyone tell me how to remove the line breaks?</p>