Array Tutorial
An array is a list of values. Using an array you can have a whole load of values in one variable.
0 | "zero" |
1 | "one" |
2 | "two" |
3 | "three" |
4 | "four" |
The numbers 0, 1, 2, 3, 4 are the indexes, the five strings "zero", "one", "two", "three", "four" are the values.
You can access elements of the array using the square bracket notation:
String s = x[2];
You can change and element similarly:
x[1] = "ONE";
You can find the number of elements with the length method:
int len = x.length;