Compilation error will occur in the following line
byte c = -a;
since the result of the "-a" expression is of type int, despite the fact that the operand is byte. This is necessary to prevent possible loss of accuracy. For example, when a = -128 the received value exceeds a byte range.
It doesn't happen during an increment / decrement operations execution because, for example, for a = 127 the value of the ++a expression will be equal to -128.
Login in to like
Login in to comment