728x90
package ch01_variable_operator;
public class Condition02 {
public static void main(String[] args) {
int a = 8, b = 7 ;
int result = a >= b ? 5 : (a + 2) ;
System.out.println("result : " + result);
int x = 5 ;
result = x%2 == 0 ? x+3 : x*x ;
System.out.println("result : " + result);
}
}
cf) Myjava/Condition02.java at master · nolooker/Myjava (github.com)
728x90
반응형
'console.log("What ? " + Cord); > Java' 카테고리의 다른 글
<Git>LogicalOperator.java (0) | 2023.02.04 |
---|---|
<Git> ErrorDebug.java (0) | 2023.02.02 |
<Git> CondOper01.java (0) | 2023.02.02 |
<Git> CondOper.java (0) | 2023.02.02 |
<Git> Casting.java (0) | 2023.02.02 |