1// This nested for loop will print 5 rows of 20 asterisks each
2
3for(int i = 0; i < 5; i++) {
4 for(int j = 0; j < 20; j++) {
5 System.out.print("*");
6 }
7 System.out.println();
8}
1for (int i = 0; i < 10; i++) {
2 for (int j = 0; j < 10; j++) {
3 System.out.println("*");
4 }
5 System.out.println("");
6}
1// outer loop
2for (int i = 1; i <= 5; ++i) {
3 // codes
4
5 // inner loop
6 for(int j = 1; j <=2; ++j) {
7 // codes
8 }
9..
10}