0
When do we need an Iterator type? (Java)
Can you explain differences in use with: for-each loop for loop while loop
1 Answer
+ 1
You would go for a while loop when you do not know the number of iterations you need to obtain the result whereas you will use for loop when you know the number of iterations required.
Difference between for and for-each loop is explained here.
https://www.sololearn.com/Discuss/2596485/?ref=app