1D Arrays
Learn 1D Arrays (Arrays, Data Structures & Algorithms) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
What is a 1D Array? A 1D array is a fixed-size, contiguous block of memory holding elements of the same type, accessed by an integer index starting at 0. Contiguous memory is what makes arr[i] an O(1) operation - the address is computed directly as base + i * elementSize . Fixed size - once created, a Java array cannot grow or shrink; use ArrayList when the size is unknown up front. Default values: 0 for numeric types, false for boolean, null for objects.