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;
Up-casting is automatic where as down-casting or narrowing (byte c=x;) should be explicit as it might cause loss of precision which a programmer should be aware of explicitly. To correct it you need to put an explicit cast byte c=(byte)x;
byte c=x;
byte c=(byte)x;