Java TutorialLesson 18Free preview
Java Break/Continue
This lesson is part of Java · All levels
Summary
Break removes execution from the loop or switch instantly, while continue through the rest of the running iteration and proceed to the next iteration. Both are useful for controlling the repetition pattern more subtly. Proper use makes code more efficient and readable.
Key points
- Break stops the entire loop and continues the code after the loop
- Continue past the remaining block of the iteration and then check the loop condition again.
- Break is also used to exit the switch block
- Use it wisely to keep the program flowing
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.