Java Reference
In-Depth Information
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:
Learn what arrays are.
■
Use arrays to store data in
and retrieve data from lists
and tables of values.
■
Declare arrays, initialize
arrays and refer to individual
elements of arrays.
■
Iterate through arrays with
the enhanced
for
statement.
■
Pass arrays to methods.
■
Declare and manipulate
multidimensional arrays.
■
Use variable-length argument
lists.
■
Read command-line
arguments into a program.
■
Build an object-oriented
instructor gradebook class.
■
Perform common array
manipulations with the
methods of class
Arrays
.
■
Use class
ArrayList
to
manipulate a dynamically
resizable arraylike data
structure.
■