-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathContinue_Statement.java
More file actions
27 lines (23 loc) · 971 Bytes
/
Continue_Statement.java
File metadata and controls
27 lines (23 loc) · 971 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
* Program: Continue Statement Demo
* Description: A Java program to demonstrate the usage of the 'continue' statement
* to skip the current iteration of a loop and proceed to the next one.
* Author: Amey Thakur
* Reference: https://github.com/Amey-Thakur/OOPM-JAVA-LAB
*/
public class Continue_Statement {
public static void main(String args[]) {
System.out.println("---------------------------------------------");
System.out.println(" Continue Statement Demo");
System.out.println("---------------------------------------------");
for (int i = 0; i < 10; i++) {
// Skip the iteration when i is 4
if (i == 4) {
System.out.println("Skipping iteration for i = " + i);
continue;
}
System.out.println("Value of i: " + i);
}
System.out.println("---------------------------------------------");
}
}