Card 08/ 08
All 8 cards
RecapDifficulty: Intermediate1 min
What an Array Gives You, and What It Refuses
Five things this topic established, and where each one was.
| The thing | Where |
|---|---|
| One variable, a fixed length, one element type, all decided at creation | One Name for Twenty Values |
| Declare, allocate, fill — and every slot starts at its type's default | From a Declaration to a Filled Array |
The index is an offset, so the last one is length - 1 | Why 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 copies | Why 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.