Java program to execute continue statement

A Java program to execute continue statement. By using this program we can print the execute the continue statement in java. The continue keyword can be used in any loop control structure. It forces the loop to immediately jump to the next iteration of the loop. When the continue keyword is used in a for loop, control is immediately passed to the update statement. The continue keyword is used in a for loop or a while loop to end the current iteration and go on to the next.

public class Main
{
public static void main(String[] args)
{
for(int i=1;i<=10;i++)
{
if(i==5)
{
continue;
}
System.out.println(i);
}
}
}

1
2
3
4
6
7
8
9
10