Question: what is the difference between iterator and iterable in java?
Answer: The iterator is the actual object that will iterate through the collection. Implementing Iterable interface allows an object to be the target of the "foreach" statement. Iterator is an interface, which has implementation for iterate over elements. Iterable is an interface which provides Iterator.