Which code fragment cause a compilation error?
A.
float flt = 100F;
B.
float flt = (float) 1_11.00;
C.
float flt = 100;
D.
double y1 = 203.22;
float flt = y1;
E.
int y2 = 100;
float flt = (float) y2;
題解
選項D會編譯錯誤,因為double不能隱含式(implicit)轉成float。