Card 08/ 08

RecapDifficulty: Intermediate1 min

What an Array Gives You, and What It Refuses

Five things this topic established, and where each one was.

What the topic established, and which card it was on
The thingWhere
One variable, a fixed length, one element type, all decided at creationOne Name for Twenty Values
Declare, allocate, fill — and every slot starts at its type's defaultFrom a Declaration to a Filled Array
The index is an offset, so the last one is length - 1Why the Last Index of a Seven-Slot Array Is Six
array.length, string.length(), collection.size()Three Spellings for Three Types
Arrays never grow; Arrays.copyOf makes a new one and copiesWhy You Cannot Make an Array One Element Longer

The one worth carrying: an array is a fixed run of slots, and every surprise in this topic comes from that one fact — the offset, the exception, and the copy you have to make to add anything.