I read Collections from the Complete Reference , and then I came across this statement
Collection interface
The collection interface is the foundation on which collections are assembled. The structure is built because it must be implemented by any class that defines the collection. A collection is a common interface that this declaration has: interface Collection<E> . Here E indicates the type of objects that will be stored in the collection. A collection extends Iterable interface.This means that all collections can cyclically use the for-each style for the loop. (Recall that only classes that implement Iterable can be looped through with for).
The last two lines say that only those classes that implement the Iterable interface can loop through the for loop. But, I think that the class of the object does not implement an iterable interface, then how can we use the for-each loop in the case of strings, integers, etc.
source share