Wednesday, February 10, 2021

 What is for each loop ???

for each loop is a special type of loop in java programming  that is more efficient to write in a code  

it is helpful to print element in a efficient manner 

less type and result is same as for loop ...

see example :

for(int i=0;i<=5;i++){

int k;             //for loop

System.out.println(" "+k);

}


for(int k : int i){

System.out.println(" "+k);      //for each loop 

}  if you want to know more about  [ for loop ,for each loop, do while loop ,while loop]..

then click on the link below ..




No comments:

Post a Comment

Featured Posts