Why casing is not reqired for the constants final int x3 = 30; short s4 = x3 + 10;
when you declare a variable final compiler knew that value of that variable will not change. here the value of x3 is 10 which can fit in short type(x3+10 also) so here cast is not necessary. In below example the value of i is 32768 which is bigger than short range so cast is required here
final int i = 32768; short s = (short) i;
why byte + byte = int. ?? IS their any reason..........
any numerical operation that involves types smaller than int will result in int.
i am not sure about reason behind it.
SCJP 1.5 94%.
The greatest glory in living lies not in never falling, but in rising every time we fall.