package ch01_variable_operator;
public class CondOper {
public static void main(String[] args) {
int x = 3, y = 8, z = 4 ;
int max = x > y ? x : y ;
max = max > z ? max : z ;
System.out.println("최대 : " + max);
// 최소 값은 ?
int min = x < y ? x : y ;
min = min < z ? min : z ;
System.out.println("최소 : " + min);
max = x > y ? (x > z ? x : z) : (y > z ? y : z) ;
System.out.println("최대 : " + max);
min = x < y ? (x < z ? x : z) : (y < z ? y : z) ;
System.out.println("최소 : " + min);
}
}
cf) Myjava/CondOper.java at master · nolooker/Myjava (github.com)
'console.log("What ? " + Cord); > Java' 카테고리의 다른 글
<Git> Condition02.java (0) | 2023.02.02 |
---|---|
<Git> CondOper01.java (0) | 2023.02.02 |
<Git> Casting.java (0) | 2023.02.02 |
<Git> ArithmeticOperator2.java (0) | 2023.02.02 |
<Git> ArithmeticOperator.java (0) | 2023.02.02 |