O'Reilly logo

The Java® Language Specification, Java SE 7 Edition, Fourth Edition by Alex Buckley, Gilad Bracha, Guy Steele, Bill Joy, James Gosling

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required