Back to Lessons

Control Flow Statements in Java

April 5, 2026

Control Flow Statements

Direct program execution based on conditions and repetitions.

Complete Example

if (age >= 18) {
    System.out.println("Adult");
} else if (age >= 13) {
    System.out.println("Teen");
} else {
    System.out.println("Child");
}

for (int i = 1; i <= 5; i++) {
    System.out.println(i);
}

Key Points

  • if-else if-else for multiple conditions.
  • switch for multiple discrete values.
  • Loops: for, while, do-while, enhanced for-each.
  • break exits loop, continue skips iteration.