Java Why is converting a long (64) to float (32) considered widening?

前端 未结 4 1412
一个人的身影
一个人的身影 2021-01-31 22:08

As it states from oracle

Reference from Oracle Docs

Widening Primitive Conversion 19 specific conversions on primitive types are called

4条回答
  •  独厮守ぢ
    2021-01-31 22:28

    It's considered widening because float and double can represent larger values than long. You may lose precision, but it will be possible to represent the value (at least approximately).

提交回复
热议问题