Java Reference
In-Depth Information
8.5.1. Static Member Type Declarations
The
static
keyword may modify the declaration of a member type
C
within the body of a
non-inner class or interface
T
. Its effect is to declare that
C
is not an inner class. Just as a
static
method of
T
has no current instance of
T
in its body,
C
also has no current instance of
T
, nor does it have any lexically enclosing instances.
It is a compile-time error if a
static
class contains a usage of a non-
static
member of an en-
closing class.
ber interface to redundantly specify the
static
modifier.
8.6. Instance Initializers
An
instance initializer
declared in a class is executed when an instance of the class is cre-
InstanceInitializer:
Block
initializer.
Instance initializers are permitted to refer to the current object via the keyword
this
scope.
Use of instance variables whose declarations appear textually after the use is some-
times restricted, even though these instance variables are in scope. See §
8.3.2.3
for
the precise rules governing forward reference to instance variables.
8.7. Static Initializers
A
static initializer
declared in a class is executed when the class is initialized (§
12.4.2
). To-
to initialize the class variables of the class.
StaticInitializer: