--- id: java-break-continue title: "Java Break Continue" category: "Programming_Language" status: "draft" verification_status: "conceptual" canonical_id: "" aliases: ["break statement", "continue statement", "μžλ°” break continue"] 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", "loops", "break", "continue"] raw_sources: ["https://www.w3schools.com/java/java_break.asp"] applied_in: [] github_commit: "" --- # [[Java Break Continue]] ## 🎯 ν•œ 쀄 톡찰 (One-line insight) `break` and `continue` are opposite loop-control tools β€” break stops the loop completely, continue skips only the current iteration and keeps looping β€” and they compose cleanly, as shown by the negative-number-skip/zero-stop real-life example combining both in one loop. [S1] ## 🧠 핡심 κ°œλ… (Core concepts) - **`break`** β€” already seen exiting switch statements; also exits a loop entirely. [S1] - **`continue`** β€” skips the rest of the current iteration and moves to the next one. [S1] - **Mnemonic** β€” "break = stop the loop completely. continue = skip this round, but keep looping." [S1] - **Works in for and while loops** β€” both statements apply to any loop type. [S1] - **Combinable** β€” a single loop can use both break and continue for different conditions. [S1] ## πŸ“– μ„ΈλΆ€ λ‚΄μš© (Details) - Break in for: `for (int i = 0; i < 10; i++) { if (i == 4) { break; } System.out.println(i); }`. [S1] - Continue in for: `for (int i = 0; i < 10; i++) { if (i == 4) { continue; } System.out.println(i); }`. [S1] - Combined: `for (int i = 0; i < 6; i++) { if (i == 2) { continue; } if (i == 4) { break; } System.out.println(i); }` β€” skips 2, stops at 4. [S1] - Break in while: `int i = 0; while (i < 10) { System.out.println(i); i++; if (i == 4) { break; } }`. [S1] - Continue in while: `int i = 0; while (i < 10) { if (i == 4) { i++; continue; } System.out.println(i); i++; }`. [S1] - Real-life array processing: `int[] numbers = {3, -1, 7, 0, 9}; for (int n : numbers) { if (n < 0) { continue; } if (n == 0) { break; } System.out.println(n); }` β€” skips negatives, stops at zero. [S1] ## βš–οΈ λͺ¨μˆœ 및 μ—…λ°μ΄νŠΈ (Contradictions & updates) μ†ŒμŠ€μ—μ„œ λͺ¨μˆœλ˜λŠ” μ •λ³΄λŠ” λ°œκ²¬λ˜μ§€ μ•ŠμŒ. ## πŸ› οΈ 적용 사둀 (Applied in summary) ν˜„μž¬ 발견된 μ‹€μ œ 적용 사둀가 μ—†μŠ΅λ‹ˆλ‹€ β€” 음수 κ±΄λ„ˆλ›°κ³  0μ—μ„œ λ©ˆμΆ”λŠ” λ°°μ—΄ 처리 μ˜ˆμ œλŠ” 필터링+μ‘°κΈ°μ’…λ£Œ 둜직의 ν‘œμ€€ νŒ¨ν„΄μ΄λ‹€. [S1] ## πŸ’» μ½”λ“œ νŒ¨ν„΄ (Code patterns) Skip negatives, stop at zero (Java): ```java int[] numbers = {3, -1, 7, 0, 9}; for (int n : numbers) { if (n < 0) { continue; // skip negative numbers } if (n == 0) { break; // stop loop when zero is found } System.out.println(n); } ``` ## βœ… 검증 μƒνƒœ 및 신뒰도 - **μƒνƒœ:** draft - **검증 단계:** conceptual - **좜처 신뒰도:** B (W3Schools β€” widely used educational reference, not a primary standards body) - **μ‹ λ’° 점수:** 0.90 - **쀑볡 검사 κ²°κ³Ό:** μ‹ κ·œ 생성 (New discovery) ## πŸ”— 지식 κ·Έλž˜ν”„ (Knowledge Graph) - **μƒμœ„/루트:** [[Java Tutorial]] - **κ΄€λ ¨ κ°œλ…:** [[Java For Loop]], [[Java While Loop]], [[Java Switch]], [[Java Arrays]] - **μ°Έμ‘° λ§₯락:** 반볡문 μ œμ–΄μ˜ 핡심 도ꡬ β€” 이후 Arrays μ±•ν„°μ—μ„œ λ°°μ—΄ μ²˜λ¦¬μ™€ κ²°ν•©λœλ‹€. ## πŸ“š 좜처 (Sources) - [S1] W3Schools β€” Java Break and Continue β€” https://www.w3schools.com/java/java_break.asp ## πŸ“ λ³€κ²½ 이λ ₯ (Change history) - 2026-07-04: Initial draft synthesized from the W3Schools "Java Break and Continue" page (Astra wiki-curation, P-Reinforce v3.1 format).