Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The conditional operator ?: uses the boolean value of its first operand to decide which of the other two expressions will be evaluated. (See §15.25, "Conditional Operator ? :" of the Java Language Specification [JLS 2011].)

The general form of a Java conditional expression is operand1 ? operand2 : operand3.

...

[Bloch 2005a]

Puzzle 8, "Dos Equis"

[Findbugs 2008]

"Bx: Primitive Value Is Unboxed and Coerced for Ternary Operator"

[JLS 2011]

§15.25, "Conditional Operator ? :"

...