Logo 
Search:

Java Articles

Submit Article
Home » Articles » Java » FundamentalRSS Feeds

Continue Statement

Posted By: Dorothy Taylor     Category: Java     Views: 1987

This article explains about continue statement in java with examples.

Continue statement forces the iteration of the loop to take place, skipping any code in between itself and the test condition of the loop.

In while and do-whileloops, a continue statement will cause control to go directly to the test condition and then continue the looping process. 
In for loop, the increment part of the loop is performed, the conditional test is executed and the loop continues.     

Syntax of Continue Statement

continue;

Example of Continue Statement 

Example 1 : Program to print even numbers

class EvenNumberLoop
{
  public static void main(String args[])
  {
for(int i = 1; i <= 10; i++)
{
System.out.println("Even Numbers : ");

if(i%2 > 0)
{
continue;
}
System.out.println(i + ", ");
}
  }
}


Output

Even Numbers : 2, 4, 6, 8, 10
  
Share: 

 
 
 

Didn't find what you were looking for? Find more on Continue Statement Or get search suggestion and latest updates.

Dorothy Taylor
Dorothy Taylor author of Continue Statement is from Baltimore, United States.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
Ajeet Kumar from India Comment on: Sep 21
Thanks for all the dailyfreecode groups.This is very beneficial site for us. Every student can access any program so, thanks alot..

View All Comments