Rule 3 of numeric promotion states:
Smaller data types, namely, byte, short, and char, are first promoted to int any time
they’re used with a
Java binary arithmetic operator with a variable (as opposed to a
value), even if neither of the operands is int.
Part in brackets confuses me: (as opposed to a value),
What happens in terms of promotion in following examples:
char c1 = 'a';
char c2 = 'b';
int i1 = c1 + c2; //Here c1 and c2 are promoted to ints?
char c3 = c1 + c2; //How about here?
int i2 = 'a' + 'b'; //There is no promotion?
char c4 = c1 + c2; //How about here?