continue statement in Java

continue statement is used in looping statements to jump immediately from a position to the next iteration.

continue when used skips the statements which are below it that to be executed in the loop and jumps to next iteration.

General Syntax

continue;

Example

public class ContinueStatement {

public static void main(String args[]) {

for(int i=0;i<5;i++) {

System.out.println(i);

if(i==0){

continue;

}

i=i+5;

}

}

}

Try In Editor

Output

0

1