Professional Documents
Culture Documents
CO4025 Introduction To Computer Programming: Array Lists
CO4025 Introduction To Computer Programming: Array Lists
Introduction to
Computer Programming
Lecture 10
Array Lists
Introduction
We’re going to look at ArrayList Objects
These are dynamic containers available within
Java
They are more flexible than arrays
We’ll see how to manipulate them with a list of
integers
We’ll expand the mechanism to deal with lists of
objects
}
}
16
Outputting Object Data From the
List
Within the method we create a new Person
object, p
We step through each element of the list
We retrieve the current object using the get()
method
We cast the retrieved object to a Person object and
assign it to p
Then we extract p’s attributes and output the details
with appropriate labels