10.1. Array Types

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

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.

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

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 ...

Get The Java® Language Specification, Java SE 7 Edition, Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.