continue Statement�  in Java

continue Statement�  in Java


Posted in : Core Java Posted on : October 7, 2010 at 5:55 PM Comments : [ 0 ]

In this example, We will Discuss about how to implement continue statement in Java programs.

continue Statement� in Java

In this example, We will Discuss about how to implement continue statement in Java programs. Sometimes we do not need to execute some statements under the loop then we use the continue statement that stops the normal flow of the control and control returns to the loop without executing the statements written after the continue statement.

In the given example we will see how the continue works.

Code:

package com.devmanuals2;

public class Continue {

	public static void main(String[] args) {
		int j;

		for (j = 1; j < 5; j++) {
			if (j == 3) {
				System.out.println("continue!");
				continue;
			}
			System.out.println(j);

		}
	}

}

Output:

1

2

continue!

4

Dowload The Code.

Go to Topic «PreviousHomeNext»

Your Comment:


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 

 
Tutorial Topics