- 2

Array Example

Kindly change this into appropriate example, i.e. related to topic.

14th Oct 2017, 10:50 PM
Ace Mangalino
Ace Mangalino - avatar
1 Answer
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];
15th Oct 2017, 5:35 PM