Continue Java Example

In this post you are going to learn continue java example.

In java, continue is a statement. So this continue statement is normally used with the loops to skip the current iteration.

Continue statement skips the remaining part of the code at specified condition.

Let’s see an example where we get better understanding on continue statement,

EXAMPLE: CONTINUE JAVA EXAMPLE

Read Also – Java Constructor Example

public class Continue_Example {

public static void main(String[] args) {

int continue_Array[] = new int[]{2,4,6,8,10};

System.out.println("Continue Example without 6 is: ");

for(int x = 0;x < continue_Array.length;x++){

if(continue_Array[x] == 6)
continue;
else
{
System.out.println(continue_Array[x]);
}
}
}
}

Output:

Continue Java Example

About the author

admin

View all posts

Leave a Reply

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