Control Transfer
A. The `break` Statement:
Forces the immediate and complete termination of the enclosing loop. Control jumps directly to the first statement outside the loop block.
for (int i = 1; i <= 10; i++) {
if (i == 5) break; // Exits loop completely when i reaches 5
System.out.print(i + " ");
} // Output: 1 2 3 4
B. The `continue` Statement:
Skips the remaining statements of the current iteration and transfers control immediately to the next iteration (jumping directly to the update expression in a for loop, or to the condition in a while loop).
for (int i = 1; i <= 5; i++) {
if (i == 3) continue; // Skips printing 3
System.out.print(i + " ");
} // Output: 1 2 4 5