5.8 break and continue Statements

In addition to selection and repetition statements, Java provides statements break (which we discussed in the context of the switch statement)and continue (presented in this section and online Appendix L) to alter the flow of control. The preceding section showed how break can be used to terminate a switch statement’s execution. This section discusses how to use break in repetition statements.

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.