Unit 6: Array Flashcards Preview

AP CS-Applications > Unit 6: Array > Flashcards

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

How do you initialize an array?

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


What is the defining characteristic of an array?

An array is of a fixed size.


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.