|
Initialize at time of declaration - filling
by list.
It is possible to fill an array at the time of declaration. |
double [ ] temperature = { 13.5, 18.4,
19.6, 21.4};
The array length (size) will be
automatically set to the
minimum that will hold the given values. The statement above is equivalent
to the following statements:
double [ ] temperature = new double [4];
temperature[0] = 13.5;
temperature[1] = 18.4;
temperature[2] = 19.6;
temperature[3] = 21.4;
|