---
id: java-data-types
title: "Java Data Types"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["primitive types", "자바 자료형"]
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", "datatypes", "primitive"]
raw_sources: ["https://www.w3schools.com/java/java_data_types.asp"]
applied_in: []
github_commit: ""
---

# [[Java Data Types]]

## 🎯 한 줄 통찰 (One-line insight)
Once a Java variable is declared with a type, it can NEVER change type — the compiler enforces this as a safety guarantee, and the only way to bridge types is explicit type casting. [S1]

## 🧠 핵심 개념 (Core concepts)
- **Two groups** — primitive types (`byte`, `short`, `int`, `long`, `float`, `double`, `boolean`, `char`) and non-primitive types (`String`, arrays, classes). [S1]
- **8 primitive types** — each with a fixed value range/precision (e.g. `byte`: -128 to 127; `int`: ~±2.1 billion; `long`: ~±9.2 quintillion; `float`: 6-7 decimal digits; `double`: 15-16 decimal digits). [S1]
- **Type is permanent** — once declared, a variable's type cannot change. [S1]
- **Compiler-enforced safety** — mixing types (e.g. assigning a String to an int) is a compile error, not a runtime surprise. [S1]
- **Type casting** — the explicit mechanism to convert between types when needed. [S1]

## 🧩 추출된 패턴 (Extracted patterns)
- **Static typing as a safety net** — the tutorial explicitly frames the "cannot change type" rule as making Java SAFER, since the compiler catches type mistakes before the program ever runs. [S1]

## 📖 세부 내용 (Details)
- All 5 basic examples: `int myNum = 5; float myFloatNum = 5.99f; char myLetter = 'D'; boolean myBool = true; String myText = "Hello";`. [S1]
- Type-change error: `int myNum = 5; myNum = "Hello"; // Error: cannot assign a String to an int`. [S1]

## ⚖️ 모순 및 업데이트 (Contradictions & updates)
소스에서 모순되는 정보는 발견되지 않음.

## 🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — 이후 Numbers/Booleans/Characters 챕터에서 각 타입이 상세히 다뤄지고, Type Casting 챕터에서 타입 변환 방법이 다뤄진다. [S1]

## 💻 코드 패턴 (Code patterns)
Type permanence enforced by the compiler (Java):
```java
int myNum = 5;      // myNum is an int
// myNum = "Hello"; // Error: cannot assign a String to an int
```

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

## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[Java Tutorial]]
- **관련 개념:** [[Java Variables]], [[Java Numbers]], [[Java Type Casting]]
- **참조 맥락:** 8개 원시 타입과 비원시 타입의 구분 — 정적 타이핑 안전성의 핵심 문서.

## 📚 출처 (Sources)
- [S1] W3Schools — Java Data Types — https://www.w3schools.com/java/java_data_types.asp

## 📝 변경 이력 (Change history)
- 2026-07-04: Initial draft synthesized from the W3Schools "Java Data Types" page (Astra wiki-curation, P-Reinforce v3.1 format).
