About Question enthuware.ocajp.i.v8.2.2018 :
Posted: Sun Oct 14, 2018 7:24 am
Hello, there is an error in the Explanation, I think...
It says:
It says:
But the JLS says (and the compiler behave so):"Similarly, when any of the operands is of type long, the result will be a long and if any of the operands is a float or a double, the result will be a double. "
"If at least one of the operands to a numerical operator is of type double, then the operation is carried out using 64-bit floating-point arithmetic, and the result of the numerical operator is a value of type double. If the other operand is not a double, it is first widened (§5.1.5) to type double by numeric promotion (§5.6).
Otherwise, the operation is carried out using 32-bit floating-point arithmetic, and the result of the numerical operator is a value of type float. (If the other operand is not a float, it is first widened to type float by numeric promotion.)".