6 ms·
JLS: https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.25 https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.htm... Otherwise, if the
by aeonsky 11y ago
JLS: https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.25 https://docs.oracle.com/javase/specs/jls/se7/html/jls-15.htm...
Otherwise, if the second and third operands have types that are convertible (§5.1.8) to numeric types, then there are several cases:
... binary numeric promotion (§5.6.2) is applied to the operand types, and the type of the conditional expression is the promoted type of the second and third operands.
... If either operand is of type double, the other is converted to double.
- gefh 11y agoRight. This is only tangentially to do with autoboxing, the same would happen for (true ? 1L : 0.0).