Array
Array
Introducing Arrays
Declaring Array Variables
Creating Arrays
Initializing Arrays
Passing Arrays to Methods
One dimensional Arrays
Two dimensional Arrays
Search and Sorting Methods
Introducing Arrays
Array is a data structure that represents a
collection of the same types of data.
double[] myList = new double[10];
datatype arrayname[];
Example:
double myList[];
Creating Arrays
Example:
myList = new double[10];
datatypearrayname[] = new
datatype[arraySize];
double myList[] = new double[10];
The Length of Arrays
arrayVariable.length
For example,
myList.length returns 10
Initializing Arrays
Using a loop:
for (int i = 0; i < myList.length; i++)
myList[i] = i;