PROGRAM:
To show use of Continue statement.
/**
* @Prof. Jayesh
* continue is a control statement.
* continue brings compiler to the top of execution structure.
*/
public class ExampleOfContinue {
public static void main(String args[])
{
int num[]={1,2,3,4,5,6,7,8,9,10};
System.out.println(“Show all numbers except 5”);
int i;
for(i=0;i = num.length;i++)
{
if(num[i]==5)
continue;
else
System.out.println(num[i]);
}
}
}
OUTPUT:
Show all numbers except 5
1
2
3
4
6
7
8
9
10