Files
2nd/10_Wiki/Dev/Topic_Java/Java_Operators_Arithmetic.md
T
Antigravity Agent 1cfd3bbb56 docs(10_Wiki): 위키 구조 정리 — 언어 튜토리얼 카테고리 폴더 제거 + 신규 자산 동기화
Topic_CSS/Topic_HTML/Topic_JavaScript/Topic_Prompt/Topic_Comfyui 등 기존 카테고리 폴더를 정리하고,
Topic_Graphic/Dev 등 신규 산출물과 Topics 내부 세션/메모리 기록을 동기화.
2026-07-05 00:10:59 +09:00

3.9 KiB

id, title, category, status, verification_status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, created_at, updated_at, review_reason, merge_history, tags, raw_sources, applied_in, github_commit
id title category status verification_status canonical_id aliases duplicate_of source_trust_level confidence_score created_at updated_at review_reason merge_history tags raw_sources applied_in github_commit
java-operators-arithmetic Java Operators Arithmetic Programming_Language draft conceptual
increment decrement
자바 산술 연산자
B 0.9 2026-07-04 2026-07-04
java
programming
w3schools
operators
arithmetic
increment
https://www.w3schools.com/java/java_operators_arithmetic.asp

Java Operators Arithmetic

🎯 한 줄 통찰 (One-line insight)

Dividing two int values ALWAYS truncates to an integer result (10 / 3 gives 3, not 3.33) — getting a decimal result requires both operands to be double, making this a common source of silent precision loss for beginners. [S1]

🧠 핵심 개념 (Core concepts)

  • Arithmetic operators+, -, *, /, % (modulus), ++ (increment), -- (decrement). [S1]
  • Integer division truncatesint / int always yields an int, discarding any remainder. [S1]
  • Double division preserves decimalsdouble / double yields the actual fractional result. [S1]
  • ++/-- — increase/decrease a variable by exactly 1. [S1]
  • Increment then decrement cancels out — ending value equals the starting value. [S1]

🧩 추출된 패턴 (Extracted patterns)

  • Integer division truncation is the classic footgun10 / 3 silently gives 3 in Java (as in most statically-typed languages), unlike Python 3 where / always returns a float; this difference trips up developers moving between languages. [S1]
  • Counter pattern via ++/-- — tracking a running count (e.g. people entering/leaving a room) is the canonical real-world use of increment/decrement. [S1]

📖 세부 내용 (Details)

  • All operators demoed: int x = 10; int y = 3; println(x + y); println(x - y); println(x * y); println(x / y); println(x % y);. [S1]
  • Integer vs. double division: int a = 10; int b = 3; System.out.println(a / b); // 3 (truncated) vs. double c = 10.0d; double d = 3.0d; System.out.println(c / d); // 3.333.... [S1]
  • Increment/decrement counter: int peopleInRoom = 0; peopleInRoom++; peopleInRoom++; peopleInRoom--;. [S1]

⚖️ 모순 및 업데이트 (Contradictions & updates)

  • 정수 나눗셈의 절삭 동작: int / int는 항상 정수 결과를 반환하며 소수점 이하는 버려진다는 점이 명시적으로 경고됨 — Type Casting 챕터의 double 캐스팅 해법과 연결된다. [S1]

🛠️ 적용 사례 (Applied in summary)

현재 발견된 실제 적용 사례가 없습니다 — 사람 수 카운팅 같은 실전 예제에서 증감 연산자의 용도가 직접 등장한다. [S1]

💻 코드 패턴 (Code patterns)

Integer division truncates, double division doesn't (Java):

int a = 10, b = 3;
System.out.println(a / b);  // 3 (truncated)

double c = 10.0d, d = 3.0d;
System.out.println(c / d);  // 3.333...

검증 상태 및 신뢰도

  • 상태: draft
  • 검증 단계: conceptual
  • 출처 신뢰도: B (W3Schools — widely used educational reference, not a primary standards body)
  • 신뢰 점수: 0.90
  • 중복 검사 결과: 신규 생성 (New discovery)

🔗 지식 그래프 (Knowledge Graph)

📚 출처 (Sources)

📝 변경 이력 (Change history)

  • 2026-07-04: Initial draft synthesized from the W3Schools "Java Arithmetic Operators" page (Astra wiki-curation, P-Reinforce v3.1 format).