Java Continue statement:

Like a break statement, it is another transfer statement.
The general form is : continue;
When a continue statement executes based on a condition inside a loop, then some portion
of the loop is skipped.

Let’s see an example;

ContinueExample.java

class ContinueExample {
    public static void main(String[] args) {
        for (int k = 1; k <= 5; k++) {
            System.out.println("Hello");
            if (k == 3) {
                continue;
            }
            System.out.println("SILAN Technology");
        }
    }
}

Output

Hello
SILAN Technology
Hello
SILAN Technology
Hello
Hello
SILAN Technology
Hello
SILAN Technology

 

Our Services:

Java Training | Python Training | Machine Learning with Python Training | Deep Learning with Python Training | Data Science with Python Training | Projects

SILAN Technology, BBSR
Call to: 0674-2361252

Comment