Control flow statements are used in programming to control the execution flow of a program. They allow programmers to:

There are three main types of control flow statements in Java:

  1. Decision-Making Statements
  2. Looping Statements
  3. Branching Statements

1. Decision-Making Statements

Decision-making statements, also known as conditional statements, help programmers make decisions about whether to execute a block of code based on a condition. Java provides four types of decision-making statements:

  1. If Statement
  2. If-Else Statement
  3. If-Else-If Ladder
  4. Switch Statement

If Statement

The if statement is a decision-making statement that executes a block of code only if a specified condition is true. If the condition is false, the block is skipped.

Syntax:

java