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

0 1 
2 3 
4 5 
6 7 
8 9

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

Similar Programs Chapter Last Updated
Java For Loop And ForEach Loop Example Control Statements 03-09-2016
Java Enum And Switch Statement Control Statements 03-09-2016
Control Statements In Java Example Control Statements 19-06-2016
If Statement In Java Example Control Statements 17-06-2016
Java Switch Example Control Statements 14-06-2016
While Loop In Java Example Control Statements 08-06-2017
Return Statement In Java example Control Statements 15-07-2016
Print Stars In Java Example Control Statements 15-07-2016
Nested Loop In Java Example Control Statements 15-07-2016
Infinite While Loop In Java Control Statements 10-06-2016
Infinite Loop In Java Example Control Statements 15-07-2016
If Else Statement In Java Example Control Statements 10-06-2016
For Loop In Java Example Control Statements 07-06-2017
For Each In Java Example Control Statements 07-06-2017
Do While Loop In Java Example Control Statements 10-06-2016
Java Break Statement Example Control Statements 06-07-2016

1