.


Divya

Java Continue statement


The main purpose of using the continue statement is to skip the current iteration and continue for the next iteration.

It can be used with for loop or while loop.It is not applicable is with statement.

In case of inner loop, it continues only inner loop.

Syntax:

jump-statement;
    continue;

Example

class Continue statement Example {
public static void main(String[] args) {
for(int a=10;a<=20;a++){
if(a==16){
continue;
}
System.out.println(a);
}
}
}

Output :
10
11
12
13
14
15
17
18
19
20



.