foreach loop works for both Iterable
interface and array types.
It works by calling the forEach
method of Iterable
interface.
Do array types in Java have forEach()
method, just as Iterable
does? Does foreach loop work for array types also by forEach
method of array types?
I have read How does primitive array work with new for each loop in Java?, but I am not sure if it answers my question.