I've been wondering about the reason why in Java we can assign an integer number directly to a char variable:
char a = 6;
but we can't assign an integer without a type cast
int bInt = 6;
char b = bInt; // error, cast first
I do understand that char is just 16-bit unsigned integer in the background, and that generally if we want to move a value from a wider range type to a lower range one, type cast needs to be explicit. But why is that not the case in the first example, what is the type of the 6 literal ?