---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 8 Edition"
java_version: 8
chapter: "Chapter 8. Classes"
section: "8.6"
heading: "8.6. Instance Initializers"
parent: "Chapter 8. Classes"
source: https://docs.oracle.com/javase/specs/jls/se8/html/jls-8.html#jls-8.6
id: "8.6"
url: https://jvm.obfuscated.software/jls/se8/8.6.html
raw: https://jvm.obfuscated.software/jls/se8/8.6.md
---

# 8.6. Instance Initializers

An *instance initializer* declared in a class is executed when an instance of the class is created ([§12.5](12.5.md), [§15.9](15.9.md), [§8.8.7.1](8.8.7.1.md)).

```
InstanceInitializer:
  Block
```

It is a compile-time error if an instance initializer cannot complete normally ([§14.21](14.21.md)).

It is a compile-time error if a `return` statement ([§14.17](14.17.md)) appears anywhere within an instance initializer.

Instance initializers are permitted to refer to the current object via the keyword `this` ([§15.8.3](15.8.3.md)), to use the keyword `super` ([§15.11.2](15.11.2.md), [§15.12](15.12.md)), 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.3](8.3.3.md) for the precise rules governing forward reference to instance variables.

Exception checking for an instance initializer is specified in [§11.2.3](11.2.3.md).
