Difference between iterator and Foreach in java?

How they both differ ….

Asked on July 20, 2019 in Software.
Add Comment
1 Answer(s)

Iterator is an interface provided by collection framework to traverse a collection and for a sequential access of items in the collection.
For eachloop is meant for traversing items in a collection.

 

refer

https://www.geeksforgeeks.org/iterator-vs-foreach-in-java/

#coclouder

Answered on July 20, 2019.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.