Explain The Basic Difference Between For And While Loop With And Example?


1 Answers

Alongbar Daimary Profile
The basic Difference between for and while loop is:
When we are using for loop it is required to know that how many times we need to repeat.
But in case of while loop it is not so.

For(int I=1 ;I<=10;I++) // here we already know that the loop will continue 10 times.

boolean ABC=false;
while(!ABC)  // Here we don't know when its execution will stop.

Answer Question