-
Obviously, from the above example,
arrays implement this interface.
-
As we shall see later,
we can also use foreach loops with the
Collection classes as they also implement this interface.
-
And, if we provide our own class that implements
the Iterable interface,
we could also use a foreach loop with an object of that class.
-
There are many situations where the traditional code for
looking at each element will still have to be
used, ...
-
e.g., if you wish to know
the element number containing the largest value of an array.