nested loop in java8 code example
Example 1: java nested loop
// This nested for loop will print 5 rows of 20 asterisks each
for(int i = 0; i < 5; i++) {
for(int j = 0; j < 20; j++) {
System.out.print("*");
}
System.out.println();
}
Example 2: java nested for loop
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
System.out.println("*");
}
System.out.println("");
}