---
id: java-conditions-logical-operators
title: "Java Conditions Logical Operators"
category: "Programming_Language"
status: "draft"
verification_status: "conceptual"
canonical_id: ""
aliases: ["logical operators in conditions", "자바 조건 논리 연산자"]
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", "conditions", "logical-operators"]
raw_sources: ["https://www.w3schools.com/java/java_conditions_logical.asp"]
applied_in: []
github_commit: ""
---

# [[Java Conditions Logical Operators]]

## 🎯 한 줄 통찰 (One-line insight)
Real-world access-control logic often nests logical operators — `isLoggedIn && (isAdmin || securityLevel <= 2)` requires login as a hard gate, then OR-branches between two different ways of satisfying the second requirement, showing how && and || combine into layered authorization rules. [S1]

## 🧠 핵심 개념 (Core concepts)
- **`&&` (AND)** — all conditions must be true. [S1]
- **`||` (OR)** — at least one condition must be true. [S1]
- **`!` (NOT)** — reverses a condition (true↔false). [S1]
- **Combines with if/else/else-if** — logical operators build more complex decision conditions. [S1]
- **Grouping with parentheses** — `(isAdmin || securityLevel <= 2)` groups an OR sub-expression before ANDing with the login gate. [S1]

## 📖 세부 내용 (Details)
- AND: `int a = 200; int b = 33; int c = 500; if (a > b && c > a) { System.out.println("Both conditions are true"); }`. [S1]
- OR: `if (a > b || a > c) { System.out.println("At least one condition is true"); }`. [S1]
- NOT: `int a = 33; int b = 200; if (!(a > b)) { System.out.println("a is NOT greater than b"); }`. [S1]
- Access-control real-life example: `boolean isLoggedIn = true; boolean isAdmin = false; int securityLevel = 3; if (isLoggedIn && (isAdmin || securityLevel <= 2)) { System.out.println("Access granted"); } else { System.out.println("Access denied"); }`. [S1]

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

## 🛠️ 적용 사례 (Applied in summary)
현재 발견된 실제 적용 사례가 없습니다 — 로그인 + (관리자 OR 높은 보안등급) 형태의 접근 제어 로직은 실제 인증 시스템의 표준 패턴이다. [S1]

## 💻 코드 패턴 (Code patterns)
Layered access control with && and || (Java):
```java
boolean isLoggedIn = true;
boolean isAdmin = false;
int securityLevel = 3; // 1 = highest
if (isLoggedIn && (isAdmin || securityLevel <= 2)) {
    System.out.println("Access granted");
} else {
    System.out.println("Access denied");
}
```

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

## 🔗 지식 그래프 (Knowledge Graph)
- **상위/루트:** [[Java Tutorial]]
- **관련 개념:** [[Java Operators Logical]], [[Java Nested If]], [[Java Conditions Real Life]]
- **참조 맥락:** 논리 연산자를 조건문에 적용 — 접근 제어 등 실전 로직의 기반.

## 📚 출처 (Sources)
- [S1] W3Schools — Java Logical Operators in Conditions — https://www.w3schools.com/java/java_conditions_logical.asp

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