8.6. Instance Initializers
An instance initializer declared in a class is executed when an instance of the class is created (§12.5, §15.9, §8.8.7.1).
InstanceInitializer: Block
It is a compile-time error if an instance initializer cannot complete normally (§14.21).
It is a compile-time error if a return
statement (§14.17) appears anywhere within an instance initializer.
Instance initializers are permitted to refer to the current object via the keyword this
(§15.8.3), to use the keyword super
(§15.11.2, §15.12), and to use any type variables in scope.
Use of instance variables whose declarations appear textually after the use is sometimes restricted, even though these instance variables are in scope. See §8.3.2.3 for the precise rules governing ...
Get The Java® Language Specification, Java SE 7 Edition, Fourth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.