---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 18 Edition"
java_version: 18
chapter: "Chapter 10. Arrays"
section: "10.1"
heading: "10.1. Array Types"
parent: "Chapter 10. Arrays"
source: https://docs.oracle.com/javase/specs/jls/se18/html/jls-10.html#jls-10.1
id: "10.1"
url: https://jvm.obfuscated.software/jls/se18/10.1.html
raw: https://jvm.obfuscated.software/jls/se18/10.1.md
---

# 10.1. Array Types

Array types are used in declarations and in cast expressions ([§15.16](15.16.md)).

An array type is written as the name of an element type followed by some number of empty pairs of square brackets `[]`. The number of bracket pairs indicates the depth of array nesting.

Each bracket pair in an array type may be annotated by type annotations ([§9.7.4](9.7.4.md)). An annotation applies to the bracket pair (or ellipsis, in a variable arity parameter declaration) that follows it.

The element type of an array may be any type, whether primitive or reference. In particular:

- Arrays with an interface type as the element type are allowed.

  An element of such an array may have as its value a null reference or an instance of any type that implements the interface.

- Arrays with an `abstract` class type as the element type are allowed.

  An element of such an array may have as its value a null reference or an instance of any subclass of the `abstract` class that is not itself `abstract`.

An array's length is not part of its type.

The supertypes of an array type are specified in [§4.10.3](4.10.3.md).

The supertype relation for array types is not the same as the superclass relation. The direct supertype of `Integer[]` is `Number[]` according to [§4.10.3](4.10.3.md), but the direct superclass of `Integer[]` is `Object` according to the `Class` object for `Integer[]` ([§10.8](10.8.md)). This does not matter in practice, because `Object` is also a supertype of all array types.
