Java Control Statements
- Java if Statement
- Java Nested if Statement
- Java if-else-if Statement
- Java Switch Case
- Java Switch with String
- Java Nested Switch
- Java Simple for Loop
- Java for each Loop
- Java Nested for Loops
- Java while loop
- Java continue Statement with for Loop
- Java continue in do-while Loop
- Java break to Exit a for Loop
- Java break with Nested Loops
This Java example demonstrates how to use a continue Statement inside the do-while loop in Java with an example.
Java continue Statement in do-while Loop Example
package net.javaguides.corejava.controlstatements.loops;
public class ContinueExample {
public static void main(String args[]) {
int j = 0;
do {
if (j == 7) {
j++;
continue;
}
System.out.print(j + " ");
j++;
} while (j < 10);
}
}
Output:
0 1 2 3 4 5 6 8 9
Note that we have skipped iteration when j==7.
Control Statements
Java
Java Tutorial
Comments
Post a Comment