---
title: "How do break and continue Statements Differ in Java?"  
description: "How do break and continue Statements Differ in Java?"  
author: "Ashutosh Patel"  
published: 2025-03-20  
updated: 2025-04-02  
canonical: https://www.mindstick.com/forum/161305/how-do-break-and-continue-statements-differ-in-java  
category: "java"  
tags: ["java", "loop", "break statement", "continue statement"]  
reading_time: 2 minutes  

---

# How do break and continue Statements Differ in Java?

How do break and continue Statements Differ in Java?

## Replies

### Reply by Khushi Singh

In [Java programming,](https://www.mindstick.com/articles/1702/introduction-to-java) the break statement and continue both perform different functions in controlling loop execution and switch statement operations. Within Java programming, code break statement acts as a command that causes an immediate halt of both the loop and switch statement execution. The break command will stop the loop iteration process before exiting the loop to continue with post-loop execution. The statement provides benefits when particular conditions become true, so further loop activities become redundant.

While the continue statement makes a loop skip its present iteration and then advance to the successive one. This statement preserves the loop operation by allowing it to move on to the subsequent cycle after skipping particular iterations without completely ending.

A [loop](https://www.mindstick.com/blog/11177/loop-in-javascript) can print numbers while skipping particular values through continue until it meets a condition where break terminates the whole process.

```java
public class BreakContinueExample {
   public static void main(String[] args) {
       for (int i = 1; i <= 10; i++) {
           if (i == 5) continue; // Skips iteration when i is 5
           if (i == 8) break; // Exits loop when i is 8
           System.out.print(i + " ");
       }
   }
}
```

**Output:**\
`1 2 3 4 6 7`

The continue statement skips printing the number 5 while the break statement causes the program to stop running when i reaches value 8. Knowledge of these statements enables proper loop control.


---

Original Source: https://www.mindstick.com/forum/161305/how-do-break-and-continue-statements-differ-in-java

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
