The Continue Keyword in Java

The proceed with decisive word can be utilized as a part of any of the loop control structures. It causes the loop to quickly bounce to the following emphasis of the loop.

  • In a for circle, the continue keyword reasons stream of control to quickly bounce to the overhaul articulation.
  • In a while or do/while loop, stream of control instantly hops to the Boolean interpretation.

The syntax of using this keyword is as follows:

continue;

Sample Implementation:

public class myTest {

public static void main(String args[]) {

int [] mynumbers = {0, 5, 10, 15, 20};

for(int i : mynumbers ) {

if( i == 15 ) {

continue;

}

System.out.print( i );

System.out.print(ā€œ\nā€);

}

}

}

The expected output of the code is:
05
10
20