Literals and implicit narrowing conversions
问题 a) Shouldn’t the following assignment cause an error, since number 100 is a literal of type int and since compiler doesn’t allow implicit narrowing conversions? byte b = 100; b) If compiler doesn’t complain about implicit narrowing conversion from int literal to type byte , then why doesn’t it also allow an implicit narrowing conversion from double literal to type float ( I realize we could avoid this error by specifying float literal using F/f suffix )? byte b=16; //OK float f1=16.9; //error