--- id: java-else title: "Java Else" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["else statement", "์ž๋ฐ” else"] 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", "conditions", "else"] raw_sources: ["https://www.w3schools.com/java/java_conditions_else.asp"] applied_in: [] github_commit: "" --- # [[Java Else]] ## ๐ŸŽฏ ํ•œ ์ค„ ํ†ต์ฐฐ (One-line insight) A stray semicolon after `if (condition)` silently breaks an if/else pair โ€” the source explicitly warns that `if (condition);` ends the statement early, making the following `else` behave unexpectedly (or fail to compile as attached to that if). [S1] ## ๐Ÿง  ํ•ต์‹ฌ ๊ฐœ๋… (Core concepts) - **`else`** โ€” runs a block only when the paired `if` condition is false; else itself carries no condition. [S1] - **Syntax** โ€” `if (condition) { ... } else { ... }`. [S1] - **No semicolon after if(condition)** โ€” doing so ends the if-statement prematurely and breaks the else pairing. [S1] ## ๐Ÿ“– ์„ธ๋ถ€ ๋‚ด์šฉ (Details) - Basic else: `boolean isRaining = false; if (isRaining) { System.out.println("Bring an umbrella!"); } else { System.out.println("No rain today, no need for an umbrella!"); }`. [S1] - Time-based greeting: `int time = 20; if (time < 18) { System.out.println("Good day."); } else { System.out.println("Good evening."); } // Outputs "Good evening."`. [S1] ## โš–๏ธ ๋ชจ์ˆœ ๋ฐ ์—…๋ฐ์ดํŠธ (Contradictions & updates) - **์„ธ๋ฏธ์ฝœ๋ก  ํ•จ์ •**: `if (condition)` ๋’ค์— ์„ธ๋ฏธ์ฝœ๋ก ์„ ๋ถ™์ด๋ฉด ์•ˆ ๋œ๋‹ค๋Š” ์ ์ด ์†Œ์Šค์—์„œ ๋ณ„๋„ Notes๋กœ ๊ฐ•์กฐ๋จ. [S1] ## ๐Ÿ› ๏ธ ์ ์šฉ ์‚ฌ๋ก€ (Applied in summary) ํ˜„์žฌ ๋ฐœ๊ฒฌ๋œ ์‹ค์ œ ์ ์šฉ ์‚ฌ๋ก€๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค โ€” ์‹œ๊ฐ„๋Œ€๋ณ„ ์ธ์‚ฌ๋ง, ๋น„/์šฐ์‚ฐ ์—ฌ๋ถ€ ๋“ฑ ์ด์ง„ ๋ถ„๊ธฐ์˜ ํ‘œ์ค€ ํŒจํ„ด์ด๋‹ค. [S1] ## ๐Ÿ’ป ์ฝ”๋“œ ํŒจํ„ด (Code patterns) Binary branch with else (Java): ```java int time = 20; if (time < 18) { System.out.println("Good day."); } else { System.out.println("Good evening."); } ``` ## โœ… ๊ฒ€์ฆ ์ƒํƒœ ๋ฐ ์‹ ๋ขฐ๋„ - **์ƒํƒœ:** draft - **๊ฒ€์ฆ ๋‹จ๊ณ„:** conceptual - **์ถœ์ฒ˜ ์‹ ๋ขฐ๋„:** B (W3Schools โ€” widely used educational reference, not a primary standards body) - **์‹ ๋ขฐ ์ ์ˆ˜:** 0.88 - **์ค‘๋ณต ๊ฒ€์‚ฌ ๊ฒฐ๊ณผ:** ์‹ ๊ทœ ์ƒ์„ฑ (New discovery) ## ๐Ÿ”— ์ง€์‹ ๊ทธ๋ž˜ํ”„ (Knowledge Graph) - **์ƒ์œ„/๋ฃจํŠธ:** [[Java Tutorial]] - **๊ด€๋ จ ๊ฐœ๋…:** [[Java If Else]], [[Java Else If]] - **์ฐธ์กฐ ๋งฅ๋ฝ:** if์˜ false ๋ถ„๊ธฐ ์ฒ˜๋ฆฌ โ€” else if๋กœ ๋‹ค์ค‘ ์กฐ๊ฑด ๋ถ„๊ธฐ ํ™•์žฅ. ## ๐Ÿ“š ์ถœ์ฒ˜ (Sources) - [S1] W3Schools โ€” Java Else โ€” https://www.w3schools.com/java/java_conditions_else.asp ## ๐Ÿ“ ๋ณ€๊ฒฝ ์ด๋ ฅ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "Java Else" page (Astra wiki-curation, P-Reinforce v3.1 format).