7. Arrays and ArrayLists

Begin at the beginning, ... and go on till you come to the end: then stop.

—Lewis Carroll

To go beyond is as wrong as to fall short.

—Confucius

Objectives

In this chapter you’ll:

Image Learn what arrays are.

Image Use arrays to store data in and retrieve data from lists and tables of values.

Image Declare arrays, initialize arrays and refer to individual elements of arrays.

Iterate through arrays with the enhanced for statement.

Pass arrays ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.