Java Break and Continue

Java Break and Continue Tutorial

Java Break and Continue

In the last topics, you learned about loops which are used to repeat a certain process some number of times.

What if we can control the way our loop operates?

In Java, we can jump out of a loop or jump to the starting condition of a loop whenever we want. We do this with the help of break and continue statements respectively.


Java break Statement



break is used to break or terminate a loop whenever we want.

Just type break; after the statement after which you want to break the loop.