Skip to main content

Looping Statements

Learn Looping Statements (Java Basics, Java) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

1. Introduction A loop repeats a block of code while a condition stays true One run of the body is an iteration. Java has for (known count), while (condition first), do-while (at least once) and the enhanced for-each over arrays and collections , each built from initialization, condition and update. Enhanced for over an array compiles to an index loop, over an Iterable to an Iterator, and break and continue control the flow.

More lessons in Java Basics