--- id: java-files title: "Java Files" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["File class", "μžλ°” 파일"] 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", "files", "io"] raw_sources: ["https://www.w3schools.com/java/java_files.asp"] applied_in: [] github_commit: "" --- # [[Java Files]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) The `File` class itself only represents a file/directory REFERENCE and its metadata (`exists()`, `length()`, `canRead()`) β€” it doesn't read or write content directly, which is why separate classes (FileWriter, Scanner, etc.) handle actual content operations in later chapters. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`File` class** β€” from `java.io`; represents a file or directory reference. [S1] - **Object creation** β€” `File myObj = new File("filename.txt");` β€” just specifies a path, doesn't create the file. [S1] - **Metadata/info methods** β€” `canRead()`, `canWrite()`, `exists()`, `getName()`, `getAbsolutePath()`, `length()`, `list()`. [S1] - **Action methods** β€” `createNewFile()`, `delete()`, `mkdir()`. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Object creation: `import java.io.File; File myObj = new File("filename.txt");`. [S1] - Method table: canRead()/canWrite() (boolean), createNewFile()/delete()/exists()/mkdir() (boolean), getName()/getAbsolutePath() (String), length() (long), list() (String[]). [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) μ†ŒμŠ€μ—μ„œ λͺ¨μˆœλ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•ŠμŒ. ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” File ν΄λž˜μŠ€λŠ” 이후 Create/Write/Read/Delete μ±•ν„°μ˜ 곡톡 κΈ°λ°˜μ΄λ‹€. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Creating a File object reference (Java): ```java import java.io.File; File myObj = new File("filename.txt"); ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.88 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[Java Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[Java Files Create]], [[Java Files Write]], [[Java Files Read]], [[Java Files Delete]] - **μ°Έμ‘° λ§₯락:** File ν΄λž˜μŠ€λŠ” 파일 μ‘°μž‘ 4단계(생성/μ“°κΈ°/읽기/μ‚­μ œ)의 곡톡 κΈ°λ°˜μ΄λ‹€. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” Java Files β€” https://www.w3schools.com/java/java_files.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "Java Files" page (Astra wiki-curation, P-Reinforce v3.1 format).