Java tutorial
Java Break and Continue
break leaves a loop immediately. continue skips the rest of the current pass and moves to the next one. In a for loop, the update still runs after continue.
Edit the code and run it again. This runner stays in your browser and covers the syntax used in these lessons.
Output
Run the example to see output here.
What this code does
The loop skips 3 because of continue, prints 1, 2, and 4, then break stops it before 5 can be printed.