Java Break Statement

Break statement in java is used to terminate loops and switch case statements. Use of break statement changes the normal sequence. Break statement is useful when we want to terminate a loop immediately without checking the condition expression of loop.

Syntax of break Statement

break;

Break statement inside loop

We can use break statement inside any loop(for, while and do-while). It terminates the loop immediately and program control resumes at the next statement following the loop. In case of nested loop, if break statement is encountered inside inner loop then it will only terminate the execution of inner loop. In general, it breaks the execution of loop enclosing it.


Break statement inside switch statement

When a break statement is encountered inside switch case, it terminates switch and program control resumes at next statement after switch statement block.