Java Loop Control and Decision Control Statements

Decision Control Statements in Java:

The Decision Control Structures help you to perform actions based on a certain condition. 

  1. if else
  2. Nested if
  3. if-else-if Ladder
  4. switch

Let me  explain this with 2 real world examples:

1. If I feel Thirsty I drink water(or beer!) else I eat pizza!

2. Consider a situation where you get in to a fight with someone in college. 

Here is the decision making your mind does:

if ( The other person is weaker than me)

Beat the shit out of him!


Keep Quiet and move on !!

We face such situations every day in our life where we have to take decisions based on a condition. To implement such situations in Java we use these Decision Making Control Structures.

Loop Control Statements:

The Loop Controls in Java helps us to keep performing a task a certain number of times or until a certain condition becomes true.

The loop constructs available in Java are:

  1. while loop in java
  2. do while loop in java
  3. for loop in java
  4. for each loop in java

Example: Suppose, you are playing football,

You keep playing football until you feel tired. (while, Do while)

You keep playing football for 45 minutes continuously i.e. till half-time break (Similar to :for loop)

Banner to

Hide Page Information

Control Statements in Java - If Else Switch and Loops in Java

Explanation of control statements and looping in java explained in a simple language