Continue Statement In Java Example
Chapter:
Control Statements
Last Updated:
30-03-2017 19:42:14 UTC
Program:
/* ............... START ............... */
public class JavaContinueExample {
public static void main(String args[]) {
for (int i = 0; i < 10; i++) {
System.out.print(i + " ");
if (i % 2 == 0)
continue;
System.out.println("");
}
}
}
/* ............... END ............... */
Output
Notes:
-
A do...while loop is similar to a while loop, except that a do.while loop is guaranteed to execute at least one time...
- Continue statement is used to skip the rest of the statement in the loop and continue with the next iteration of the loop.
- Continue is the Keyword in Java .
- In a for loop, the continue keyword causes control to immediately jump to the update statement.
- In a while loop or do/while loop, control immediately jumps to the Boolean expression.
- Continue Statement skips the Loop and Re-Executes Loop with new condition.
Tags
Continue Statement, Java