---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 24 Edition"
java_version: 24
chapter: "Chapter 5. Loading, Linking, and Initializing"
section: "5.4.2"
heading: "5.4.2. Preparation"
parent: "5.4. Linking"
source: https://docs.oracle.com/javase/specs/jvms/se24/html/jvms-5.html#jvms-5.4.2
id: "5.4.2"
url: https://jvm.obfuscated.software/jvms/se24/5.4.2.html
raw: https://jvm.obfuscated.software/jvms/se24/5.4.2.md
---

# 5.4.2. Preparation

*Preparation* involves creating the static fields for a class or interface and initializing such fields to their default values ([§2.3](2.3.md), [§2.4](2.4.md)). This does not require the execution of any Java Virtual Machine code; explicit initializers for static fields are executed as part of initialization ([§5.5](5.5.md)), not preparation.

During preparation of a class or interface C, the Java Virtual Machine also imposes loading constraints ([§5.3.4](5.3.4.md)):

1. Let `L_1` be the defining loader of C. For each instance method `m` declared in C that can override ([§5.4.5](5.4.5.md)) an instance method declared in a superclass or superinterface D = `<N_2`, `L_2>`, for each class or interface name `N` mentioned by the descriptor of `m` ([§4.3.3](4.3.3.md)), the Java Virtual Machine imposes the loading constraint `N^{L_1}` = `N^{L_2}`.
2. For each instance method `m` declared in a superinterface I = `<N_3`, `L_3>` of C, if C does not itself declare an instance method that can override `m`, then a method is selected ([§5.4.6](5.4.6.md)) with respect to C and the method `m` in I. Let D = `<N_2`, `L_2>` be the class or interface that declares the selected method. For each class or interface name `N` mentioned by the descriptor of `m`, the Java Virtual Machine imposes the loading constraint `N^{L_2}` = `N^{L_3}`.

Preparation may occur at any time following creation but must be completed prior to initialization.
