0

When do we need an Iterator type? (Java)

Can you explain differences in use with: for-each loop for loop while loop

12th Dec 2020, 6:31 PM
Tellha safdar
Tellha safdar - avatar
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
12th Dec 2020, 7:22 PM
Avinesh
Avinesh - avatar