Chapter 4 - Creating and Using Arrays
Creating and Using Arrays
An array is used to store a collection of data, but it is used array as a collection of variables of the same type.
Instead of declaring individual variables, such as number0, number1, ..., and number99, declare one array variable such as numbers and use numbers, numbers, and ..., numbers to represent individual variables.
Declaring Array Variables:
To declare a variable to reference the array, specify the type of array the variable can reference.
dataType arrayRefVar; // preferred way.
dataType arrayRefVar; // works but not preferred way.
dataType arrayRefVar is preferred.
double myList; // preferred way.
double myList; // works but not preferred way.
Creating and Using Arrays in Java