docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고, Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
---
|
||||
id: java-var-keyword
|
||||
title: "Java Var Keyword"
|
||||
category: "Programming_Language"
|
||||
status: "draft"
|
||||
verification_status: "conceptual"
|
||||
canonical_id: ""
|
||||
aliases: ["var (Java 10+)", "type inference", "자바 var 키워드"]
|
||||
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", "var", "type-inference"]
|
||||
raw_sources: ["https://www.w3schools.com/java/java_var.asp"]
|
||||
applied_in: []
|
||||
github_commit: ""
|
||||
---
|
||||
|
||||
# [[Java Var Keyword]]
|
||||
|
||||
## 🎯 한 줄 통찰 (One-line insight)
|
||||
`var` (Java 10+) is type INFERENCE, not dynamic typing — the compiler still locks in a fixed type at the moment of assignment (`var x = 5;` → permanently int), so `x = 9.99;` later still errors exactly as if you'd written `int x = 5;` explicitly. [S1]
|
||||
|
||||
## 🧠 핵심 개념 (Core concepts)
|
||||
- **`var`** (Java 10, 2018) — lets the compiler infer a variable's type from its assigned value. [S1]
|
||||
- **Must assign at declaration** — `var x;` alone is an error; `var x = 5;` is required. [S1]
|
||||
- **Type still locked in** — once inferred, the type cannot change, exactly like an explicit declaration. [S1]
|
||||
- **Best for complex types** — most useful for verbose generic types like `ArrayList<String>`, less useful for simple types where explicit typing is already clear. [S1]
|
||||
|
||||
## 🧩 추출된 패턴 (Extracted patterns)
|
||||
- **var is sugar, not a type system change** — it removes REPETITION (`ArrayList<String> cars = new ArrayList<String>();` → `var cars = new ArrayList<String>();`) without weakening static type safety at all. [S1]
|
||||
|
||||
## 📖 세부 내용 (Details)
|
||||
- Basic inference: `var x = 5; // x is an int`. [S1]
|
||||
- Multiple types inferred: `var myNum = 5; var myDouble = 9.98; var myChar = 'D'; var myBoolean = true; var myString = "Hello";`. [S1]
|
||||
- Must assign immediately: `var x; // Error` vs. `var x = 5; // OK`. [S1]
|
||||
- Type stays locked: `var x = 5; x = 10; // OK; x = 9.99; // Error`. [S1]
|
||||
- Reduces verbosity for complex types: `var cars = new ArrayList<String>();` instead of `ArrayList<String> cars = new ArrayList<String>();`. [S1]
|
||||
|
||||
## ⚖️ 모순 및 업데이트 (Contradictions & updates)
|
||||
소스에서 모순되는 정보는 발견되지 않음.
|
||||
|
||||
## 🛠️ 적용 사례 (Applied in summary)
|
||||
현재 발견된 실제 적용 사례가 없습니다 — ArrayList/HashMap처럼 제네릭 타입이 장황할 때 코드 가독성을 높이는 데 쓰인다. [S1]
|
||||
|
||||
## 💻 코드 패턴 (Code patterns)
|
||||
var reduces verbosity for generic types (Java):
|
||||
```java
|
||||
// Without var
|
||||
ArrayList<String> cars = new ArrayList<String>();
|
||||
// With var
|
||||
var cars = new ArrayList<String>();
|
||||
```
|
||||
|
||||
## ✅ 검증 상태 및 신뢰도
|
||||
- **상태:** draft
|
||||
- **검증 단계:** conceptual
|
||||
- **출처 신뢰도:** B (W3Schools — widely used educational reference, not a primary standards body)
|
||||
- **신뢰 점수:** 0.88
|
||||
- **중복 검사 결과:** 신규 생성 (New discovery)
|
||||
|
||||
## 🔗 지식 그래프 (Knowledge Graph)
|
||||
- **상위/루트:** [[Java Tutorial]]
|
||||
- **관련 개념:** [[Java Variables]], [[Java ArrayList]], [[Java Data Types]]
|
||||
- **참조 맥락:** 타입 추론으로 코드 간결화 — 여전히 정적 타이핑 안전성은 유지된다.
|
||||
|
||||
## 📚 출처 (Sources)
|
||||
- [S1] W3Schools — Java var Keyword — https://www.w3schools.com/java/java_var.asp
|
||||
|
||||
## 📝 변경 이력 (Change history)
|
||||
- 2026-07-04: Initial draft synthesized from the W3Schools "Java var Keyword" page (Astra wiki-curation, P-Reinforce v3.1 format).
|
||||
Reference in New Issue
Block a user