6. continue statement
- we can use only inside loops and to skip the matched condition and executes the remains.
Syntax:
continue ;
--------------------------------------------------------------------------------
Program : A program to print one by one elements from an array
Program name : ContinueDemo1.java
Output :
1
2
4
5
class ContinueDemo1
{
public static void main(String args[])
{
for(int i = 1; i<=5; i++)
{
if( i == 3 )
{
continue;
}
System.out.print(i);
}
}
}
Compile : javac ContinueDemo1.java
Run : java ContinueDemo1
Output :
1
2
4
5
--------------------------------------------------------------------------------
Thanks for your time.
- Nireekshan