- 2
Array Example
Kindly change this into appropriate example, i.e. related to topic.
1 ответ
0
If you are asking what an array is, an array is a ordered collection of values if a certain type. For example, you might have a double array, which stores a collection of doubles.
To make an array, use square-bracket notation; this denotes the array. Start with the type, followed by the square-brackets, and then the variable's name. This declares the existence of the variable. If you want to initialize the array, add an equals sign, the term "new", to denote a new array, then its type, and square-brackets. Within the square-brackets, put an integer value representing the size of the array.
For example, a double array with a length of four:
double[] d;
d = new double[4];