1/12
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Array
a contiguous chunk of memory to store an ordered list of related data
declare
reserving or requesting memory for the array
populate
to put data into an empty array
traverse
visiting or accessing every element in the array
initializer list
allows an array to be declared and initialized in one statement
how to declare array
datatype [] arrayName = new datatype [#ofElements];
int [] cats = new int [2];
.length
how many elements are in an array
.length - 1
prints the last element of array
Once an array has been instantiated…
the number of elements cannot be changed.
Array of Objects
collection of object references
When an array of objects is instantiated…
it is filled with null.
Each object, like a Coin object, needs to be instantiated.
The references need to be copied into the array.
Is it possible to have an array of objects where some of the elements are null and some of the elements have references pointing to objects?
YES