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 (§ or ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.