Nested For Loop in Java
A nested for loop is a for loop inside another for loop. The inner loop runs completely for each iteration of the outer loop.
Code Snippet
//Nested For Loop in Java
public class App {
public static void main(String[] args) {
for (int i = 1; i <= 5; i++) // 1<=5 2<=5
{
for (int j = 1; j <= 5; j++) {
System.out.print("*");
}
System.out.println("");
}
}
}