Continue statement in Java

Continue statement in Java

Continue statement in Java is used to jump to the next iteration of the loop. It is used to continue the flow of program and skip the code at specific condition. It can be used in while and for loops.

Q. Write a program to show the use of continue statement in java.


class example
  public static void main(String[] args) {
    for(int i=1;i<=20;i++)


continue statement java output


Firstly for loop is declared with integer ‘i’ having value 1 and condition of i<=20. So the loop will continue to print the value of ‘i’ and increment. Then if condition is checked. So if the value of ‘i’ is not divisible by 2, continue statement will be executed. Then the print statement is skipped and the flow continues. When the condition of i<=20 is satisfied, the program terminates.

Program parts-

  1. class– Used to declare a class in java.
  2. publicAccess modifier which represents it is visible to all.
  3. static– The main method is declared as static, so it doesn’t require to create an object to invoke the main method.
  4. void– Return type of the method.
  5. main– Represents the starting point of the program.
  6. String[] args– Used for command line argument.
  7. System.out.println()– System is a class, out is the object of PrintStream class, println() is the method of PrintStream class. System.out.println is used to print a statement.


So this is the concept of continue statement in Java. We hope it was clear to you. If you have any doubts tell us in the comment section. For daily updates and more such content do follow us on Instagram.

Keep programming!


Leave a Reply

Your email address will not be published. Required fields are marked *