Java Reference
In-Depth Information
In all cases, the throws clause of an anonymous constructor must list all the checked
exceptions thrown by the explicit superclass constructor invocation statement con-
tained within the anonymous constructor, and all checked exceptions thrown by
any instance initializers or instance variable initializers of the anonymous class.
Note that it is possible for the signature of the anonymous constructor to refer to an
inaccessible type (for example, if such a type occurred in the signature of the su-
perclass constructor cs ). This does not, in itself, cause any errors at either compile-
time or run-time.
15.10. Array Creation Expressions
An array creation expression is used to create new arrays (§10).
ArrayCreationExpression:
new PrimitiveType DimExprs Dims opt
new ClassOrInterfaceType DimExprs Dims opt
new PrimitiveType Dims ArrayInitializer
new ClassOrInterfaceType Dims ArrayInitializer
DimExprs:
DimExpr
DimExprs DimExpr
DimExpr:
[ 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 an interface type (§9).
The rules above imply that the element type in an array creation expression cannot be
a parameterized type, other than an unbounded wildcard.
The type of each dimension expression within a DimExpr must be a type that is convertible
5.1.8 ) to an integral type, or a compile-time error occurs.
Search WWH ::




Custom Search