little java help with loops
<p>Hi I am doing some practice problems and trying to print a diagonal line like the example below. I have writen the program you see below and I honestly dont understand what I am doing wrong. I m a java beginner and I cant see how to find the error. </p>

<p>Example:</p>

<pre><code>*
  *
    *
      *
        *
</code></pre>

<p>code: </p>

<pre><code>class Diagonal{
  public static void main(String args[]) {
    int row, col;


    for(row = 1; row &lt; 6; row++) {
      for(col = 1; col &lt;= row; col++) {
          if(col==row){
            System.out.print("*");
          } else{
              System.out.print("");
          }
          System.out.println();     
      }
    }
  }
}
</code></pre>

<p>I am trying to learn for loops because they really confuse me. Another practice is to print a similar diagonal line but this time from right to left. I cant do that without getting this right however :( I believe they will be pretty similar?
Above my reasining is this: As long as the column # is the same as the row number the print the line or otherwise leave a blank....what's wrong with how i did it?</p>

<p>THANK YOU! </p>
