Launch offer
Business website $150 USD Custom plugin $200 USD Ready in 5 days
Get a quote
Java

break and continue in Java

Exit loops early with break or skip an iteration with continue.

break and continue in Java — a practical guide to Java break continue with clear examples you can reuse in real projects.

Java Tutorial Series (22/90). Prefer one article? Read the complete Java tutorial.

Short description

`break` stops the loop. `continue` jumps to the next iteration.

break/continue

for (int i = 1; i <= 5; i++) {
    if (i == 2) continue;
    if (i == 4) break;
    System.out.println(i);
}

Leave a reply

Your email address will not be published. Required fields are marked *