Ticker

6/recent/ticker-posts

Java (Continue statement)

CONTINUE STATEMENT IN JAVA



INTRODUCTION
In Java programming language, the continue statement is used to skip the current iteration of the loop. 
Actually it jumps to the next iteration of the loop immediately. We can use the continue statement with all types of loops (While, Do-while and For loop).

CONTINUE STATEMENT SYNTAX
for(statement ...)
{
if(condition ...)
{
continue;
}
}


CONTINUE STATEMENT EXAMPLE
class continue_statement
{
public static void main(String args[])
{
int i;

for(i=1; i<=10; i++)
{
System.out.println(i);

if(i == 5)
{
System.out.println("Continue statement excuted ...");
continue;
}
}

}

}


- - - PROGRAM OUTPUT - - -





OOP CONCEPT IN JAVA >>



Post a Comment

0 Comments