--- id: java-syntax title: "Java Syntax" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["main method", "μžλ°” 문법"] 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", "syntax", "main-method"] raw_sources: ["https://www.w3schools.com/java/java_syntax.asp"] applied_in: [] github_commit: "" --- # [[Java Syntax]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) The filename MUST exactly match the public class name (`Main` β†’ `Main.java`), because Java uses the class name to locate and run the code β€” a mismatch is a hard error, not a warning. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **Every line of runnable code lives inside a class** β€” class names conventionally start with an uppercase letter. [S1] - **Case-sensitive** β€” `MyClass` and `myclass` are different names. [S1] - **Filename must match the class name** β€” `class Main` must be saved as `Main.java`. [S1] - **`main()` method** β€” required in every Java program; the entry point where execution starts. [S1] - **`System.out.println()`** β€” prints a line of text; `System` is a built-in class, `out` is its output member, `println()` is the print-line method. [S1] - **Semicolons required** β€” every statement must end with `;`. [S1] - **Curly braces `{}`** β€” mark the start/end of a code block. [S1] ## 🧩 μΆ”μΆœλœ νŒ¨ν„΄ (Extracted patterns) - **Filename-class binding is unusually strict** β€” unlike many languages where filenames are just organizational, Java enforces filename == public class name as a hard requirement for compilation to succeed. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Basic structure: `public class Main { public static void main(String[] args) { System.out.println("Hello World"); } }`, saved as `Main.java`. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) μ†ŒμŠ€μ—μ„œ λͺ¨μˆœλ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•ŠμŒ. ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” public/static/void ν‚€μ›Œλ“œλŠ” 이후 OOP 챕터(Modifiers)μ—μ„œ μƒμ„Ένžˆ 닀뀄진닀. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Minimal Java program structure (Java, file: Main.java): ```java public class Main { public static void main(String[] args) { System.out.println("Hello World"); } } ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.90 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[Java Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[Java Intro]], [[Java Statements]], [[Java Modifiers]] - **μ°Έμ‘° λ§₯락:** Java ν”„λ‘œκ·Έλž¨μ˜ κΈ°λ³Έ 골격 β€” public/static/voidλŠ” 이후 Modifiers μ±•ν„°λ‘œ 이어진닀. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” Java Syntax β€” https://www.w3schools.com/java/java_syntax.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "Java Syntax" page (Astra wiki-curation, P-Reinforce v3.1 format).