Is there a difference between BigDecimal(“0”) and BigDecimal.ZERO?

后端 未结 4 1436
忘了有多久
忘了有多久 2020-12-30 21:56

Either for comparisons or initialization of a new variable, does it make a difference which one of these you use?

I know that BigDecimal.ZERO is a 1.5 feature, so th

4条回答
  •  情深已故
    2020-12-30 22:44

    Out of curiosity I checked to constructor for BigDecimal and it doesn't have any optimizations for the "0" string. So definitely yes, there's a difference.

提交回复
热议问题