Java Loops

 Loops:

Loops are repeating code, until a specific condition is met.


  1. While Loop
  2.  DO-While Loop
  3. For Loop
  4. Continue and Break 
While Loop :

int i=0;
While (condition ){
---//repeated until condition is true

Example

int i =0;
while(i<=4){
i++;
}
}

DO-while Loop :

Do - will excute first and checks its condition in while , if it is true , it is repeated ,once while becomes  false it will come out of do while loop .
do 
{
....

}while(condition);

example:

int j=1;
do {
//
j++
}while(j<=3);

For Loop :


for (intialization; condition; update statement){
---}

for (int i =0 ; i<=100; i++);


continue- skipping steps and loops.

break - is for stopping the loop .










Comments

Popular posts from this blog

Implicit and Explicit Waits,FluentWait,PageLoadTimeOut

A Interview Questions- selenium