---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 20 Edition"
java_version: 20
chapter: "Chapter 2. The Structure of the Java Virtual Machine"
section: "2.9"
heading: "2.9. Special Methods"
parent: "Chapter 2. The Structure of the Java Virtual Machine"
source: https://docs.oracle.com/javase/specs/jvms/se20/html/jvms-2.html#jvms-2.9
id: "2.9"
url: https://jvm.obfuscated.software/jvms/se20/2.9.html
raw: https://jvm.obfuscated.software/jvms/se20/2.9.md
---

# 2.9. Special Methods

## 2.9.1. Instance Initialization Methods

A class has zero or more *instance initialization methods*, each typically corresponding to a constructor written in the Java programming language.

A method is an instance initialization method if all of the following are true:

- It is defined in a class (not an interface).
- It has the special name `<init>`.
- It is `void` ([§4.3.3](4.3.3.md)).

In a class, any non-`void` method named `<init>` is not an instance initialization method. In an interface, any method named `<init>` is not an instance initialization method. Such methods cannot be invoked by any Java Virtual Machine instruction ([§4.4.2](4.4.2.md), [§4.9.2](4.9.2.md)) and are rejected by format checking ([§4.6](4.6.md), [§4.8](4.8.md)).

The declaration and use of an instance initialization method is constrained by the Java Virtual Machine. For the declaration, the method's `access_flags` item and `code` array are constrained ([§4.6](4.6.md), [§4.9.2](4.9.2.md)). For a use, an instance initialization method may be invoked only by the *invokespecial* instruction on an uninitialized class instance ([§4.10.1.9](4.10.1.9.md)).

Because the name `<init>` is not a valid identifier in the Java programming language, it cannot be used directly in a program written in the Java programming language.

## 2.9.2. Class Initialization Methods

A class or interface has at most one *class or interface initialization method* and is initialized by the Java Virtual Machine invoking that method ([§5.5](5.5.md)).

A method is a *class or interface initialization method* if all of the following are true:

- It has the special name `<clinit>`.

- It is `void` ([§4.3.3](4.3.3.md)).

- In a `class` file whose version number is 51.0 or above, the method has its `ACC_STATIC` flag set and takes no arguments ([§4.6](4.6.md)).

  The requirement for `ACC_STATIC` was introduced in Java SE 7, and for taking no arguments in Java SE 9. In a class file whose version number is 50.0 or below, a method named `<clinit>` that is `void` is considered the class or interface initialization method regardless of the setting of its `ACC_STATIC` flag or whether it takes arguments.

Other methods named `<clinit>` in a `class` file are not class or interface initialization methods. They are never invoked by the Java Virtual Machine itself, cannot be invoked by any Java Virtual Machine instruction ([§4.9.1](4.9.1.md)), and are rejected by format checking ([§4.6](4.6.md), [§4.8](4.8.md)).

Because the name `<clinit>` is not a valid identifier in the Java programming language, it cannot be used directly in a program written in the Java programming language.

## 2.9.3. Signature Polymorphic Methods

A method is *signature polymorphic* if all of the following are true:

- It is declared in the `java.lang.invoke.MethodHandle` class or the `java.lang.invoke.VarHandle` class.
- It has a single formal parameter of type `Object[]`.
- It has the `ACC_VARARGS` and `ACC_NATIVE` flags set.

The Java Virtual Machine gives special treatment to signature polymorphic methods in the *invokevirtual* instruction ([§*invokevirtual*](6.5.invokevirtual.md)), in order to effect invocation of a *method handle* or to effect access to a variable referenced by an instance of `java.lang.invoke.VarHandle`.

A method handle is a dynamically strongly typed and directly executable reference to an underlying method, constructor, field, or similar low-level operation ([§5.4.3.5](5.4.3.5.md)), with optional transformations of arguments or return values. An instance of `java.lang.invoke.VarHandle` is a dynamically strongly typed reference to a variable or family of variables, including `static` fields, non-`static` fields, array elements, or components of an off-heap data structure. See the `java.lang.invoke` package in the Java SE Platform API for more information.
