Chapter 10: How to work with arrays Flashcards
1
Q
What is an Array?
A
An array is an object that contains one or more items called elements.
2
Q
What are the methods associated with a the Array class?
A
type arrayName[] = new type[length];
3
Q
Describe one and two dimensional array
A
One dimension array uses a single index, whereas, two dimensional arrays use two indexes and can be thought of as columns and rows.
4
Q
Describe the “enhanced” loop
A
The enhanced, or foreach, loop doesn’t use separate expressions to initialize, test, and increment a counter variable. Instead it declares a variable that’s used to refer to each element of the array. for (type variableName : arrayName) {statements};