term1 Definition1term2 Definition2term3 Definition3
Please sign in to your Google account to access your documents:
A single array variable
can reference a large collection of data
Array basics
once an array is created, its size is fixed
an array reference variable is used to access the elements in an array using an index
Declaring an array variable
elementType[] arrayRefVar;
New operator
you can create an array by using the new operator and assign its reference to the variable
arrayRefVar = new elementType[arraySize];
this creates an array using new elementTYpe[arraySize] and it assigns the reference of the newly created array to the variable araryRefVar
Array length
the size of an array cannot be changed after the array is created
indexed variable
arrayRefVar[index];
array initializer
combines the declaration, creation, and initialization of an array in one statement using the following syntax
elementType[] arrayRefVar = {value0, value1, ..., valuek};
double[] myList = {1.9, 2.9, 3.4....etc};
Processing arrays
often use a for loop
all elements in an array are of the same type
they are evenly processed in the same fashion repeatedly using a loop
since the size of the array is known it is natural to use a for loop
Need help typing ? See our FAQ (opens in new window)
Please sign in to create this set. We'll bring you back here when you are done.
Discard Changes Sign in
Please sign in to add to folders.
Sign in
Don't have an account? Sign Up »
You have created 2 folders. Please upgrade to Cram Premium to create hundreds of folders!