Layers of Logic

Phase IV

Data in Rows

Fixed-length indexed data, array references, traversal, aliasing, and copying.

2 sections39 min of reading8 exercises

Arrays put a fixed number of indexed elements behind one reference. This phase covers creation, default values, traversal, bounds, aliasing, copying, jagged arrays and the short String API distinction. It also separates Java guarantees from JVM implementation models: references are opaque, collectors may move objects, and source code cannot assume raw addresses or one physical layout.

When you finish this phase you can

  • Declare, fill and walk an array using both loop styles
  • Predict default values and the exceptions caused by null references and invalid indexes
  • Trace aliasing, shallow copies and independent primitive-array copies
  • Traverse rectangular and jagged arrays using each row's own length
  • Explain fixed length and how an array-backed list grows by allocating and copying
  • Explain constant-time indexed access with an offset model without claiming Java exposes addresses
  • Distinguish language guarantees from JVM choices about object layout, registers, heap regions and GC movement
  1. 4.1ArraysFixed-length indexed data, default values, references, copying, and arrays whose rows can have different lengths.ReferenceArrayCore19 min5 exercises
  2. 4.2How Arrays WorkConstant-time indexed access, opaque references, bounds checks, and the implementation details Java deliberately hides.The heapRandom accessDeeper20 min3 exercises