...
If the result of the addition is greater than the maximum value or less than the minimum value that can be represented as an int
, then the variable temp
will contain an erroneous result. This does not apply to shorter types such as byte
and short
because the operands are promoted to an int
before the operation is carried out in cases where the value may not be representable. The compiler disallows storing the result of the such an operation in a variable of type shorter than an int
.
...