Hacker News new | ask | show | jobs
by aeonsky 3935 days ago
JLS: 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.

1 comments

Right. This is only tangentially to do with autoboxing, the same would happen for (true ? 1L : 0.0).