What is difference between Iterator and for loop

Answer Posted / bapi paul

An Iterator is an Object, which goes through a Collection
and you can do something with whatever the Iterator is
pointing at.
One big advantage is, that you don't have to know the size
of your Collection.


A Loop is a construct, that repeats something for a certain
amount of times.
One big advantage is, that you always know, at which
position you are.

Is This Answer Correct ?    62 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

if u open login & logout ,how can udisplay the timelogin & logout members ?

1756


Is java same as core java?

588


What is a ternary operator in java?

539


What are the wrapped, classes?

601


What all methods are used to prevent thread execution ?

558






What is data type modifier?

530


What does next mean in java?

540


What is package protected in java?

528


What is the list interface?

612


What is prefix of a string?

575


How to invoke external process in java.

570


How do you find the maximum number from an array without comparing and sorting?

641


Which is the class in java?

521


How do you check if two strings are equal in java?

587


What is the abstract class?

597