Chapter 8 - Terminology Flashcards
An ____ is a sequence of variables of the same data type. The data type can be any Java primitive data type, such as int, float, double, byte, short, long, boolean, or char, or it can be a class.
array
Each ____ in the array is accessed using the array name and an index, which refers to the ____’s position in the array.
element
Arrays are implemented as _____.
objects
Creating an array consists of _____.
declaring an object reference for the array and instantiating the array
The size of the array is given when the array is _____.
instantiated
In arrays of ____ types, each element of the array contains a value of that type.
primitive
In arrays of ____, each element is an object reference.
objects
When an array is instantiated, the elements are given initial values automatically, depending on the data type. Numeric types are set to ____; boolean types are set to ____; char types are set to the ____; and object references are set to ____.
Numeric = 0
Boolean = false
Char = unicode null character
object references = null
Instantiating an array of object references involves two steps:
instantiating the array and instantiating the objects.
Arrays can be instantiated when they are declared by assigning initial values:
in a comma-separated list within curly braces
The number of values in the initialization list determines:
the number of elements in the array.
Array elements are accessed using the:
array name and an index. (ie. a[i])
The first element’s index is __ and the last element’s index is ___.
0 and array.length-1
Arrays have an integer instance variable, ____, which holds the number of elements in the array.
length
Attempting to access an element of an array using an index less than 0 or greater than arrayName.length – 1 will generate an:
ArrayIndexOutOfBoundsException at run time.