Continue Statement in Java

This example shows how to use the continue statement in Java programming. In my previous example I have explained about the break statement which is useful for termination the look and come out of it. However, in certain cases one might want to terminate only the current iteration and skip to the next iteration. In that scenario, one might fine continue statement is very useful. Here I have written a very simple example to explain the continue statement and its usage. If you have any questions, please write it in the comments section.


import java.util.ArrayList;
 * Continue statement example
 * @author krishna
public class ContinueExample {
	public static void main(String args[]){
		ArrayList<String> days = new ArrayList<String>();
		for (String str : days){
			if (str.equals("Wednesday")){
				System.out.println("Today is Wednessday!!!. I am skiping it");
			System.out.println("Day : " + str );



Day : Monday
Day : Tuesday
Today is Wednessday!!!. I am skiping it
Day : Thursday
Day : Friday
Day : Saturday
Day : Sunday

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Pin It on Pinterest

Share This

Share this post with your friends!

Share This

Share this post with your friends!