3.2.1.2 Single and multi-dimensional arrays. Flashcards
1
Q
Define the use of a single array.
A
To store multiple values in a single variable, instead of declaring variables for each value.
2
Q
Define the syntax to declare an array.
A
String[ ] cars;
3
Q
How do you access the elements of an array?
A
By referring to the index number.
e.g.
System.out.println(cars[0]);
4
Q
Define a multi-dimensional array.
A
An array containing one or more arrays.
5
Q
Define the syntax.
A
int [ ] [ ] myNumbers = { {1, 2, 3, 4}, {5, 6, 7} };