--- id: java-variables title: "Java Variables" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["μžλ°” λ³€μˆ˜"] 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", "variables"] raw_sources: ["https://www.w3schools.com/java/java_variables.asp"] applied_in: [] github_commit: "" --- # [[Java Variables]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) Unlike Python, Java is statically typed β€” every variable declaration must state a type (`type variableName = value;`), and that type cannot silently change later the way Python's dynamic typing allows. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Basic types** β€” `String` (text, double-quoted), `int` (whole numbers), `float` (decimals), `char` (single character, single-quoted), `boolean` (true/false). [S1] - **Declaration syntax** β€” `type variableName = value;`. [S1] - **Declare-then-assign** β€” `int myNum; myNum = 15;` is also valid, splitting declaration and assignment. [S1] - **Reassignment overwrites** β€” assigning a new value replaces the old one. [S1] - **`final` keyword** β€” makes a variable unchangeable/read-only; reassigning raises a compile error. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Static typing is the core Java/Python divergence** β€” every Java variable's type is fixed at declaration and enforced by the compiler, unlike Python where `x = 4; x = "Sally"` is legal. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - String declaration: `String name = "John"; System.out.println(name);`. [S1] - Int declaration: `int myNum = 15;`. [S1] - Separate declare/assign: `int myNum; myNum = 15;`. [S1] - Reassignment: `int myNum = 15; myNum = 20;`. [S1] - final (immutable): `final int myNum = 15; myNum = 20; // error`. [S1] - All basic types together: `int myNum = 5; float myFloatNum = 5.99f; char myLetter = 'D'; boolean myBool = true; String myText = "Hello";`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) μ†ŒμŠ€μ—μ„œ λͺ¨μˆœλ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•ŠμŒ. ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” 이후 Data Types μ±•ν„°μ—μ„œ 각 νƒ€μž…μ΄ μƒμ„Ένžˆ 닀뀄진닀. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Five basic types declared (Java): ```java int myNum = 5; float myFloatNum = 5.99f; char myLetter = 'D'; boolean myBool = true; String myText = "Hello"; ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.90 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[Java Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[Java Data Types]], [[Java Constants Final]], [[Python Variables]] - **μ°Έμ‘° λ§₯락:** 정적 νƒ€μ΄ν•‘μ΄λΌλŠ” Java의 핡심 νŠΉμ„± β€” Python의 동적 타이핑과 λŒ€λΉ„. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” Java Variables β€” https://www.w3schools.com/java/java_variables.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "Java Variables" page (Astra wiki-curation, P-Reinforce v3.1 format).