それは、文ではなく式であること。
int num = -1;
return Math.signum(num) == 1.0 ? "positive" : "negative or 0";そして、複数回連続で使用する場合に、可読性が向上すること。
int score = 80; // 0 ~ 100
String rank = score >= 100 ? "SSS"
: score >= 95 ? "SS"
: score >= 90 ? "S"
: score >= 80 ? "A"
: score >= 70 ? "B"
: score >= 60 ? "C"
: "単位なし";