Java Reference
In-Depth Information
static
Block
tializer.
It is a compile-time error if the keyword
this
(§
15.8.3
)
or the keyword
super
(§
15.11
,
§
15.12
)
or any type variable declared outside the static initializer, appears anywhere within a static
initializer.
Use of class variables whose declarations appear textually after the use is sometimes
restricted, even though these class variables are in scope. See §
8.3.2.3
for the precise
rules governing forward reference to class variables.
8.8. Constructor Declarations
ConstructorDeclaration:
ConstructorModifiers
opt
ConstructorDeclarator
Throws
opt
ConstructorBody
ConstructorDeclarator:
TypeParameters
opt
SimpleTypeName
(
FormalParameterList
opt
)
The
SimpleTypeName
in the
ConstructorDeclarator
must be the simple name of the class
that contains the constructor declaration; otherwise a compile-time error occurs.
In all other respects, the constructor declaration looks just like a method declaration that
has no result type.
Constructor declarations are not members. They are never inherited and therefore are not
subject to hiding or overriding.
Example 8.8-1. Constructor Declarations
class Point {
int x, y;