15.10. Array Creation Expressions

An array creation expression is used to create new arrays (§10).

ArrayCreationExpression:    new PrimitiveType DimExprs Dimsopt    new ClassOrInterfaceType DimExprs Dimsopt    new PrimitiveType Dims ArrayInitializer    new ClassOrInterfaceType Dims ArrayInitializerDimExprs:    DimExpr    DimExprs DimExprDimExpr:    [ Expression ]Dims:    [ ]    Dims [ ]

An array creation expression creates an object that is a new array whose elements are of the type specified by the PrimitiveType or ClassOrInterfaceType.

It is a compile-time error if the ClassOrInterfaceType does not denote a reifiable type (§4.7). Otherwise, the ClassOrInterfaceType may name any named reference type, even an abstract class type (§8.1.1.1) or ...

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.