Entry Controlled Loop: Fixed Iteration

An introduction to `for` and `while` loops with reference to fixed iteration analogy.

Chapter’s recap

As we have seen earlier, in many code snippets, the statements inside our source files are generally executed from top to bottom. The looping statements are no exception. In this chapter, we will try to understand how looping statements, including for, while, and do-while work. We will also learn about the branching statements such as break, continue, and return.

In a loop, a statement or a set of statements are repeatedly executed until the condition is satisfied. As we just saw, there are three types of loops supported by Java programming. They are:

  • for loop
  • while loop
  • do-while loop

Get hands-on with 1200+ tech skills courses.