java - Where does the JLS specify that the result of an addition is int if its operands are of smaller type? -
with reference why getting type mismatch: cannot convert int byte, tried quick search in jls find mentioned result of addition between byte
operands automatically widened int
.
the best found tutorial, didnt' find in jls.
the conversions chapter not mention addition operator, @ least couldn't find something. additive operators paragraph not mention automatic widening of byte. mentions the type of each of operands of binary - operator must type convertible (§5.1.8) primitive numeric type
, nothing widening. , byte numeric data type.
what missing?
you there, in 15.18.2:
binary numeric promotion performed on operands (§5.6.2).
Comments
Post a Comment