Java Reference
In-Depth Information
Nested Loops
As you have seen in some of the preceding examples, one loop can be nested inside of an-
other. Nested loops are used to solve a wide variety of programming problems and are an
essential part of programming. So, before leaving the topic of Java's loop statements, let's
look at one more nested loop example. The following program uses a nested for loop to
find the factors of the numbers from 2 to 100:
Here is a portion of the output produced by the program:
Search WWH ::




Custom Search