Use break to exit loops and continue to skip to the next iteration.
Source Code
for (int i = 0; i < 10; i++) {
if (i == 4) {
break; // Exits the loop
}
if (i == 2) {
continue; // Skips the current iteration
}
System.out.println(i);
}