Control Flow Statements

The statements inside your program are generally executed from top to bottom,in the order that they appear. Control flow statements, however, break up the flow of execution by employing decision making, looping and branching, enabling your program to conditionally execute particular blocks of code.

Conditionals

The conditional statements are used to execute different code blocks based on different conditions.

If Statement
Switch Statement
Tenary Operator

Looping Statements

There are 4 looping constructs in Java. These are used to execute a specific block of code multiple times.

While loop
Do-while loop
For loop
Foreach Loop

Branching Statements

There are 3 branching statements

break
continue
return

results matching ""

    No results matching ""