Keyword in Java

The continue keyword in Java programming language

The continue keyword in Java programming language

We will describe about the continue keyword in Java programming language

continue is used to skip  execution (rest of loop)of a current iteration in a for loop or a while loop or do-while loop followed by advancement to the next iteration.

Flow of control of continue

Syntax

Syntax of the continue keyword

for(i=0; i<max; i++)
{
<statements>
if(done with this part)
{
//optional
continue;
}
//rest of loop statement
<statement>
}

 

Example for continue keyword

public class Continue_Keyword{

    public static void main(String args[]){
      for (int i=0; i<=5; i++)
      {
        if (i==3)
            {
            continue;  //continue keyword
            }
        System.out.print(i+" ");
      }
    }

}

 

When the above code is compiled and executed, it will produce the following result

1  2  4  5

When using the break statements, the flow of control completely exits from the loop. continue statement ends the current iteration and jumps to the next iteration of the loop.

 

There are other Java language keywords that are similar to this keyword

try keyword in Java

Catch keyword in Java

implements keyword in java

public Key words in Java

static keyword in Java language

Volatile Keyword in Java

Transient keyword in Java

Package keyword in Java

class keyword in Java

boolean keyword in Java

break keyword in Java

do keyword in Java

double keyword in Java

This keyword in Java

final keyword in Java

switch keyword in Java

interface keyword in java

extends keyword in Java language

 

Suggested for you

 Java language Keywords

C language Keywords

 Python language Keywords

keywords in C language

Usage of final keyword in Java

Usage of this keyword in Java

Finally keyword in Java language

 

 

 

 

The case keyword in Java programming language
The catch keyword in Java programming language
Karmehavannan

I am Mr S.Karmehavannan. Founder and CEO of this website. This website specially designed for the programming learners and very especially programming beginners, this website will gradually lead the learners to develop their programming skill.

Recent Posts

How to find reverse number using method in Java

How to find reverse number using method In this article, we will discuss the concept…

2 days ago

C# inverted full pyramid star pattern

C# inverted full pyramid star pattern In this article, we will discuss the concept of…

3 weeks ago

C# Full Pyramid star pattern program

C# Full Pyramid star pattern program In this article, we will discuss the concept of…

1 month ago

Program to count vowels,consonants,words, characters and space in Java

Program to count vowels, consonants, words, characters and space in Java In this article, we…

1 month ago

How to print multiplication table using Array in C++ language

How to print multiplication table using Array in C++ language In this post, we will…

1 month ago

C Program to multiplication table using Array

C Program to multiplication table using Array In this tutorial , we will discuss about…

2 months ago