---
id: java-methods-return
title: "Java Methods Return"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["return statement", "자바 메서드 반환값"]
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", "methods", "return"]
raw_sources: ["https://www.w3schools.com/java/java_methods_return.asp"]
applied_in: []
github_commit: ""
---

# [[Java Methods Return]]

## 🎯 한 줄 통찰 (One-line insight)
Storing a method's return value in a variable (`int z = myMethod(5, 3);`) is explicitly recommended over inlining it directly in `System.out.println()`, purely for readability/maintainability — both are functionally identical. [S1]

## 🧠 핵심 개념 (Core concepts)
- **Return type replaces `void`** — using `int` instead of `void` signals the method returns a value. [S1]
- **`return` keyword** — sends a value back to the caller and ends method execution. [S1]
- **Return type must match a primitive type** — e.g., `int myMethod(int x) { return 5 + x; }`. [S1]
- **Storing vs. inlining the result** — assigning to a variable first is recommended for readability. [S1]
- **Loop + return combination** — calling a value-returning method repeatedly inside a for loop. [S1]

## 📖 세부 내용 (Details)
- Basic return: `static int myMethod(int x) { return 5 + x; } ... System.out.println(myMethod(3)); // 8`. [S1]
- Two-parameter sum: `static int myMethod(int x, int y) { return x + y; } ... myMethod(5, 3); // 8`. [S1]
- Stored in variable (recommended): `int z = myMethod(5, 3); System.out.println(z);`. [S1]
- Loop + return, "doubling game": `static int doubleGame(int x) { return x * 2; } for (int i = 1; i <= 5; i++) { System.out.println("Double of " + i + " is " + doubleGame(i)); }`. [S1]

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

## 🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — 반복문 안에서 반환값 메서드를 호출하는 "더블링 게임" 예제가 실전 응용의 표본이다. [S1]

## 💻 코드 패턴 (Code patterns)
Value-returning method called inside a loop (Java):
```java
static int doubleGame(int x) {
    return x * 2;
}
for (int i = 1; i <= 5; i++) {
    System.out.println("Double of " + i + " is " + doubleGame(i));
}
```

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

## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[Java Tutorial]]
- **관련 개념:** [[Java Methods Param]], [[Java Methods Overloading]], [[Java For Loop]]
- **참조 맥락:** void가 아닌 반환값을 갖는 메서드 — 오버로딩 챕터로 이어짐.

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

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