by Dinesh Thakur

A Computer is used for performing many Repetitive types of tasks The Process of Repeatedly performing tasks is known as looping .The Statements in the block may be Executed any number of times from Zero to Up to the Condition is True. The Loop is that in which a task is repeated until the condition is true or we can say in the loop will Executes all the statements are until the given condition is not to be false.

 

These are generally used for repeating the statements. In this There is Either Entry Controlled loop or as Exit Controlled Loop We know that before Execution of Statements all Conditions are Checked these are Performed by Entry Controlled Loops Which First Checks Condition And in Exit Controlled Loop it Checks Condition for Ending Loop Whether given Condition is False or not if a Loop First Checks Condition For Execution then it is called as Entry Controlled Loop and if a Loop Checks Condition after the Execution of Statement then they are Called as Exit Controlled Loops.

 

In The loop generally there are three basic operations are performed

1) Initialization

2) Condition check

3) Increment

 

There are the three types of loops in the java

1) while

2) do-while

3) for

 

all these are used for performing the repetitive tasks until the given condition is not true.

 

1)   While: - While Loop is Known as Entry Controlled Loop because in The while loop first we initialize the value of variable or Starting point of Execution and then we check the condition and if the condition is true then it will execute the statements and then after it increments or decrements the value of a variable. But in the while loop if a Condition is false then it will never Executes the Statement So that For Execution, this is must that the Condition must be true.

 

2) Do while:- This is Also Called as Exit Controlled Loop we know that in The while loop the condition is check before the execution of the program but if the condition is not true then it will not execute the statements so for this purpose we use the do while loop in this first it executes the statements and then it increments the value of a variable and then last it checks the condition So in this either the condition is true or not it Execute the statement at least one time.

 

3) For: - In This loop all the basic operations like initialization, condition checking and incrementing or decrementing all these are performed in only one line. This is similar to the while loop for performing its execution but only different in its syntax.

 

 







About Us

Dinesh ThakurDinesh Thakur is a Columinist and designer with strong passion and founder of Computer Notes. if you have any ideas or any request Find Dinesh Thakur on
linkedin FaceBook Twitter Google Plus