Recap - Simple Logic
Coddy Java 여정의 기초 섹션에 포함된 레슨 — 73개 중 24번째.
챌린지
초급다음 코드 스니펫이 주어졌을 때, b4가 true로 평가되도록 변수 b1, b2, b3에 boolean 값(true 또는 false)을 할당하는 것이 당신의 작업입니다.
변수 b4는 다음 로직을 사용하여 계산됩니다:
- b1, b2, 그리고 b3의 NOT 사이에서 AND 연산(&&)을 수행합니다
- b4가 true가 되기 위해서는 AND 연산의 모든 부분이 true여야 합니다
직접 해보기
public class Main {
public static void main(String[] args) {
boolean b1 = ?;
boolean b2 = ?;
boolean b3 = ?;
boolean b4 = b1 && b2 && (!b3);
System.out.println("b4 = " + b4);
}
}기초의 모든 레슨
4Operators Part 1
Arithmetic OperatorsModulo OperatorIncrement/DecrementPost Increment/DecrementArithmetic ShortcutsComparison OperatorsString Comparison5Operators Part 2
Logical Operators Part 1Logical Operators Part 2Recap - Simple LogicLogical Operators Part 3Logical Operators Part 43Variables Part 2
ConstantsNaming ConventionsRecap - Initialize VariablesType Casting Part 1Type Casting Part 26Decision Making
If StatementIf - ElseSwitch StatementTernary OperatorRecap - If ElseNested If - Else