This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
In the case where the operand is of type char, byte, or short, both binary numeric promotion and an implicit narrowing conversion are performed to achieve the side effect of modifying the value of the operand.
The side effect of incrementing the value of byte variable d requires binary numeric promotion to perform int addition, followed by an implicit narrowing conversion of the int value to byte.
Something that I found in JLS: When an operator applies binary numeric promotion to a pair of operands, each of which must denote a value of a numeric type, the following rules apply, in order, using widening conversion (�5.1.2) to convert operands as necessary:
If either operand is of type double, the other is converted to double. Otherwise, if either operand is of type float, the other is converted to float. Otherwise, if either operand is of type long, the other is converted to long. Otherwise, both operands are converted to type int.
Yogvinder Singh Ghotra
Joined: Sep 10, 2007
Binary Numeric Promotion: If T is broader than int, both operands are converted to T; otherwise, both operands are converted to int.