Additionally, there exists a “for-each” loop designed specifically for iterating through elements within an array.
|
Using a “for-each” loop, the following example prints out all elements in the cars array.
|
Note: If the example above seems confusing, don’t worry. You’ll learn more about arrays in the Java Arrays chapter. |