What is this Nested For Loop doing? (Asterisk Right Triangle)
<p>I just started learning about "nested for loops". But my question what is the nested for loop exactly doing every time it loops? I'm still confused as to what is variable "i" is doing and what is variable "j" is doing. If you can explain what is happening after every loop, it would make nested for loops much clearer.</p>

<pre><code>import java.util.Scanner;

public class LoopStatement {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);

        int numStar;

        System.out.print("Number of stars: ");
        numStar = input.nextInt();

        while (numStar &lt; 1 &amp;&amp; numStar &gt; 20) {
            System.out.println("Enter a valid number ");
            numStar = input.nextInt();
        }

        for (int i = 1; i &lt;= numStar; i++) {
            for (int j = 1; j &lt;= i; j++) {
                System.out.print("*");
            }
            System.out.println();
        }
    }
}
</code></pre>

<p>So this is the output I get if I input <strong>4</strong> for <strong>numStar</strong></p>

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