Integer arithmetic in Java with char and integer literal

It is because the compiler can check that it ('a' + 10) is within the bounds of a char whereas it cannot (in general) check that 'a' + <an integer> is within the bounds.

Leave a Comment