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;//compilation error
}
}
Why 20
is automatically type-casted to byte
while x
not?