6 Arrays and ArrayLists
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.
Perform common array manipulations with the methods of class
Arrays
.Use class
ArrayList
to manipulate a dynamically resizable array-like data structure.
Get Java How To Program, Late Objects, 11th 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.