Langauge/JAVA

삼항연산자

유로파니 2020. 4. 2. 21:12
(a > b) ? a : b; 

ex)
System.out.println((score>=90)? "A학점" : (score>=80)? "B학점" : (score>=70)? "C학점" : (score>=60)? "D학점" : "F학점");

a > b 입니까? true면 a, false면 b

 

0 === "0"

>false