Nested Loop In Java Example
Chapter:
Control Statements
Last Updated:
15-07-2016 10:11:29 UTC
Program:
/* ............... START ............... */
public class JavaNestedLoop {
public static void main(String args[]) {
int i, j;
for (i = 0; i < 10; i++) {
for (j = i; j < 10; j++)
System.out.print(".");
System.out.println();
}
}
}
/* ............... END ............... */
Output
..........
.........
........
.......
......
.....
....
...
..
.
Notes:
-
In Nested Loop each iteration of the outer loop, the inner loop will be executed.
Tags
Nested Loop, Java