I saw one line of code like below:
for (String w : words) sentence.add(w); // words is declared as String[] words = ...;
To my knowledge, I think that to be able to write for loop in this format, we need the 'words' being an instance of a class which implements Iterable interface and override the iterator() function. But 'words' is of type String array, how can this for loop format correct?
Can someone give me some tips please?