---
id: java-enum-constructor
title: "Java Enum Constructor"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["자바 열거형 생성자"]
duplicate_of: ""
source_trust_level: "B"
confidence_score: 0.88
created_at: 2026-07-04
updated_at: 2026-07-04
review_reason: ""
merge_history: []
tags: ["java", "programming", "w3schools", "oop", "enums", "constructor"]
raw_sources: ["https://www.w3schools.com/java/java_enum_constructor.asp"]
applied_in: []
github_commit: ""
---

# [[Java Enum Constructor]]

## 🎯 한 줄 통찰 (One-line insight)
An enum constructor MUST be private — and uniquely, if you forget to write `private`, Java adds it automatically rather than erroring, since enum constants can only ever be created by the enum itself when the constants are declared, never by outside code. [S1]

## 🧠 핵심 개념 (Core concepts)
- **Enum constructor** — runs automatically once for each constant when the enum is loaded; cannot be called manually. [S1]
- **Per-constant arguments** — `LOW("Low level"), MEDIUM("Medium level"), HIGH("High level");` passes a distinct value to the constructor for each constant. [S1]
- **Private-only constructor** — must be `private`; Java auto-adds it if omitted. [S1]
- **Getter for constant data** — a regular method (e.g. `getDescription()`) exposes the field set by the constructor. [S1]
- **Combines with `values()`** — looping via `values()` while also calling the getter on each constant. [S1]

## 📖 세부 내용 (Details)
- Enum with constructor and field: `enum Level { LOW("Low level"), MEDIUM("Medium level"), HIGH("High level"); private String description; private Level(String description) { this.description = description; } public String getDescription() { return description; } }`. [S1]
- Access: `Level myVar = Level.MEDIUM; System.out.println(myVar.getDescription()); // "Medium level"`. [S1]
- Loop with description: `for (Level myVar : Level.values()) { System.out.println(myVar + ": " + myVar.getDescription()); } // LOW: Low level / MEDIUM: Medium level / HIGH: High level`. [S1]

## ⚖️ 모순 및 업데이트 (Contradictions & updates)
- **생성자의 private 강제성**: private을 명시하지 않아도 Java가 자동으로 추가한다는 점이 명시됨(다른 생성자 규칙과 차별화). [S1]

## 🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — 각 enum 상수에 설명 문자열을 부여하는 패턴은 상태 코드/레벨 표현의 실전 응용이다. [S1]

## 💻 코드 패턴 (Code patterns)
Enum with a private constructor assigning per-constant data (Java):
```java
enum Level {
    LOW("Low level"),
    MEDIUM("Medium level"),
    HIGH("High level");

    private String description;
    private Level(String description) {
        this.description = description;
    }
    public String getDescription() {
        return description;
    }
}
```

## ✅ 검증 상태 및 신뢰도
- **상태:** draft
- **검증 단계:** conceptual
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
- **신뢰 점수:** 0.88
- **중복 검사 결과:** 신규 생성 (New discovery)

## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[Java Tutorial]]
- **관련 개념:** [[Java Enums]], [[Java Constructors]], [[Java User Input]]
- **참조 맥락:** enum에 생성자로 부가 데이터를 부여하는 패턴 — User Input & Date 섹션으로 이어짐.

## 📚 출처 (Sources)
- [S1] W3Schools — Java Enum Constructor — https://www.w3schools.com/java/java_enum_constructor.asp

## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "Java Enum Constructor" page (Astra wiki-curation, P-Reinforce v3.1 format).
