What is Loop?

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.

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.

Know more athttp://ecomputernotes.com


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s