The index of the first component of an array is always 0.
99, 199, and 1023 respectively. The index of the last component of an array is always one less than the length of the array.
An array can have as few as zero components; that you can declare an array with no components at all. However you cannot declare an array with a negative number of components. If you try, a java.lang.NegativeArraySizeException will be thrown at runtime.
{ or } is a brace. [ or ] is a bracket. Braces are used to initialize arrays. Brackets are used to select a component of an array by specifying its index.
class array346 {
public static void main(String[] args) {
double[][][] array = new double[3][4][6];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
array[i][j][k] = Math.random();
}
}
}
double max = array[0][0][0];
double min = array[0][0][0];
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
for (int k = 0; k < 3; k++) {
if (max < array[i][j][k]) max = array[i][j][k];
if (min > array[i][j][k]) min = array[i][j][k];
}
}
}
System.out.println("Maximum: " + max);
System.out.println("Minimum: " + min);
}
}