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
Before talking about runtime penalties, make sure that this piece of code matters. Set up profiling and measure the complete use case.
Nevertheless, prefer Bigdecimal.ZERO
as it's checked at compile time whereas you can accidentally type new BigDecimal("9")
, which the compiler will accept, but which will cause bugs into your application.