I\'d a code snippet:
class AutoTypeCast{ public static void main(String...args){ int x=10; byte b=20;//no compilation error byte c=x;
Because x is an int and has a wider range as byte. That is why there may be data loss is you assign it to byte.
x
int
byte
20 is a constant and while compile time garanteed to be in the range of byte.
20