for (int i = 1; i <= 5; i++) { // outer loop iterates 5 times.
for (int j = 1; j <= 10; j++) { // for each iteration of outer loop,
// inner loop iterates 10 times
System.out.print((i * j) + " ");
}
System.out.println();
}
First iteration of outer loop (10 iterations of inner loop)
i = 1, j = 1
i = 1, j = 2
...
i = 1, j = 10
Second iteration of outer loop (10 iterations of inner loop)
i = 2, j = 1
i = 2, j = 2
...
i = 2, j = 10
...
Last iteration of outer loop (10 iterations of inner loop)
i = 5, j = 1
i = 5, j = 2
...
i = 5, j = 10