A literal 0
is considered to be an int
literal; literal 0.0
is a double
literal. When assigning to a double
, either will work (since the int
can be cast in a widening conversion); however, casting 0.0
to an int
is a narrowing conversion, and must be done explicitly; i.e. (int)0.0
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…