--- id: java-super-keyword title: "Java Super Keyword" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["super keyword", "μžλ°” super"] duplicate_of: "" source_trust_level: "B" confidence_score: 0.9 created_at: 2026-07-04 updated_at: 2026-07-04 review_reason: "" merge_history: [] tags: ["java", "programming", "w3schools", "oop", "super", "inheritance"] raw_sources: ["https://www.w3schools.com/java/java_super.asp"] applied_in: [] github_commit: "" --- # [[Java Super Keyword]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) `super()` (calling the parent constructor) must be the FIRST statement in a subclass constructor β€” the exact same rule as `this()` for constructor chaining β€” meaning Java allows only one "delegate first" call per constructor, either to another local constructor or to the parent's, never both, and only at the very start. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`super`** β€” refers to the parent class of a subclass; primarily resolves name collisions between super/subclass methods or attributes. [S1] - **`super.method()`** β€” calls the parent's version of an overridden method. [S1] - **`super.attribute`** β€” accesses the parent's attribute when the subclass shadows it with a same-named field. [S1] - **`super()`** β€” calls the parent class's constructor; must be the first statement in the subclass constructor. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Calling parent method: `class Dog extends Animal { public void animalSound() { super.animalSound(); System.out.println("The dog says: bow wow"); } }` β€” outputs both the parent's and child's messages. [S1] - Accessing parent attribute: `class Animal { String type = "Animal"; } class Dog extends Animal { String type = "Dog"; public void printType() { System.out.println(super.type); } }` β€” prints "Animal", not "Dog". [S1] - Calling parent constructor: `class Animal { Animal() { System.out.println("Animal is created"); } } class Dog extends Animal { Dog() { super(); System.out.println("Dog is created"); } }` β€” prints both messages in order. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) - **super() 호좜 μœ„μΉ˜ μ œμ•½**: μ„œλΈŒν΄λž˜μŠ€ μƒμ„±μž λ‚΄ 첫 번째 λ¬Έμž₯이어야 ν•œλ‹€λŠ” 점이 [[Java This Keyword]]의 this() κ·œμΉ™κ³Ό λ™μΌν•˜κ²Œ 강쑰됨. [S1] ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” Animalβ†’Dog κ³„μΈ΅μ—μ„œ λΆ€λͺ¨ μƒμ„±μž/λ©”μ„œλ“œ/속성에 μ ‘κ·Όν•˜λŠ” ν‘œμ€€ νŒ¨ν„΄μ΄λ‹€. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Calling the parent constructor first via super() (Java): ```java class Animal { Animal() { System.out.println("Animal is created"); } } class Dog extends Animal { Dog() { super(); // must be first statement System.out.println("Dog is created"); } } ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.90 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[Java Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[Java Inheritance]], [[Java This Keyword]], [[Java Polymorphism]] - **μ°Έμ‘° λ§₯락:** λΆ€λͺ¨ 클래슀 μ ‘κ·Ό ν‚€μ›Œλ“œ β€” this() κ·œμΉ™κ³Ό λŒ€μΉ­λ˜λŠ” μ œμ•½μ„ 가짐. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” Java super β€” https://www.w3schools.com/java/java_super.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "Java super Keyword" page (Astra wiki-curation, P-Reinforce v3.1 format).