Unit 6: Array Flashcards Preview

AP CS-Applications > Unit 6: Array > Flashcards

Flashcards in Unit 6: Array Deck (3)
Loading flashcards...
1

How do you initialize an array?

type[] name = new type[int];
or
type[] name = {type, type, ...};

2

What is the defining characteristic of an array?

An array is of a fixed size.

3

When would you use a for-each loop instead of a for loop?

When you want to access every element of an array and want to refer to elements through a variable name instead of an array index.