3.2.1.2 Single and multi-dimensional arrays. Flashcards

You may prefer our related Brainscape-certified 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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Define the syntax to declare an array.

A

String[ ] cars;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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]);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Define a multi-dimensional array.

A

An array containing one or more arrays.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Define the syntax.

A

int [ ] [ ] myNumbers = { {1, 2, 3, 4}, {5, 6, 7} };

How well did you know this?
1
Not at all
2
3
4
5
Perfectly