Java: Types of control flow statement

A normal execution in java programming language happens in the top to bottom order and the statement within that code execution proceeds in the order by which they appear.

In java, we can control that flow of execution using certain statements. These statements are called control flow statements which ensure the smooth flow of execution based on the provided statements.

There are 3 types:

1. Decision Making Control Flow Statements

Depending upon the provided condition this flow works in such a way of the given condition is mostly comprised of boolean.

  1.         if-else statement
  2.         switch statement

2. Jump Control Flow Statements

Jumps out of a current flow of code execution when a certain condition is fulfilled and proceeds to the next step of the code.

  1.         break statement
  2.         continue statement
  3.         return statement       

3. Loop Control Flow Statements

To make repetitive iterations of looping certain code execution parts based on the provided condition.

  1.         for loop
  2.         for-each loop 
  3.         do-while loop
  4.         while loop
Tue, 11/02/2021 - 13:03

Authored by

Ashwin is working with iVagus as a Technical Lead. He has experience in various technologies like Cypress, JavaScript, TypeScript, Rest Assured, Selenium, Cucumber, and Java.