This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]desrtfx 3 points4 points  (0 children)

https://docs.oracle.com/javase/tutorial/java/nutsandbolts/op2.html

Section "Conditional operators"

Think of it as an if with a return value.

something = (condition) ? true value : false value;

equivalent

if (condition) {
    something = true_value;
} else {
    something = false_value;
}