The continue statement

The continue statement is used in loops when you want to skip to the next iteration. This example shows how the first iteration in the loop is always skipped:

During the first iteration the value of variable i is 0. Since we skip that iteration and jump directly to the next, the output from the code is:

The same principle can be applied to other loops as well, like the while loop and the do-while loop.

Search for more Java info on this site here:
Custom Search

Please type any questions here.