---
spec: JLS
title: "The Java Language Specification"
edition: "Java SE 16 Edition"
java_version: 16
chapter: "Chapter 16. Definite Assignment"
section: "16.5"
heading: "16.5. Definite Assignment and Enum Constants"
parent: "Chapter 16. Definite Assignment"
source: https://docs.oracle.com/javase/specs/jls/se16/html/jls-16.html#jls-16.5
id: "16.5"
url: https://jvm.obfuscated.software/jls/se16/16.5.html
raw: https://jvm.obfuscated.software/jls/se16/16.5.md
---

# 16.5. Definite Assignment and Enum Constants

The rules determining when a variable is definitely assigned or definitely unassigned before an enum constant ([§8.9.1](8.9.1.md)) are given in [§16.8](16.8.md).

This is because an enum constant is essentially a `static` `final` field ([§8.3.1.1](8.3.1.1.md), [§8.3.1.2](8.3.1.2.md)) that is initialized with a class instance creation expression ([§15.9](15.9.md)).

- V is definitely assigned before the declaration of a class body of an enum constant with no arguments that is declared within the scope of V iff V is definitely assigned before the enum constant.
- V is definitely assigned before the declaration of a class body of an enum constant with arguments that is declared within the scope of V iff V is definitely assigned after the last argument expression of the enum constant

The definite assignment/unassignment status of any construct within the class body of an enum constant is governed by the usual rules for classes.

- V is [un]assigned before the first argument to an enum constant iff it is [un]assigned before the enum constant.
- V is [un]assigned before `y` (an argument of an enum constant, but not the first) iff V is [un]assigned after the argument to the left of `y`.
