# Array

An array is a numerically indexed collection of elements holding values.

*Closest Wikipedia entry:* Array data type — In computer science, an array type is a data type that represents a collection of elements (values or variables), each selected by one or more indices (identifying keys) that can be computed at run time during program execution. Such a collection is usually called an array variable, array value, or simply array. By analogy with the mathematical concepts vector and matrix, array types with one and two indices are often called vector type and matrix type, respectively.

## Misconceptions about Array21 documented Misconceptions

Check YourselfArrayAccessWithParentheses

Parenthesis are used to access an element in an arrayArrayAllocationWithoutNew

Arrays are created without the new keywordArrayBracketCountIsLength

The number of brackets in an array type or an array initializer corresponds to the length of the arrayArrayElementTypeRepeats

The type of a multi-dimensional array is written as T[] T[] T[]ArrayElementsUntyped

Elements of arrays are untypedArrayHasLengthMethod

To get the length of an array, one needs to call its length methodArrayInitializerContentsInBrackets

Array initializers list the elements in square bracketsArrayLengthCannotBeZero

An array cannot have a length of 0 elementsArrayLengthPartOfType

The length of an array is part of its typeArrayListIsArray

ArrayLists are arraysArrayRankIsLength

Array rank and array length are the same thingArrayRankNotPartOfType

The rank of an array is not part of its typeArraysGrow

Arrays can grow dynamicallyForEachIteratesOverIndices

An enhanced for loop iterates over the indices of an array or a collectionForEachVariableIsElement

One can assign to the variable of an enhanced for statement to store a value in the corresponding array or collection elementMultidimensionalArray

A multi-dimensional array is one thingNoJaggedArrays

Multi-dimensional arrays have a rectangular shapeOnlyInnermostArrayElements

Only the elements of the innermost array of a multi-dimensional array are accessibleOutOfBoundsElementsAreNull

Out-of-bounds array elements are null