BigDecimal objects are immutable
suggest changeIf you want to calculate with BigDecimal you have to use the returned value because BigDecimal objects are immutable:
BigDecimal a = new BigDecimal("42.23"); BigDecimal b = new BigDecimal("10.001"); a.add(b); // a will still be 42.23 BigDecimal c = a.add(b); // c will be 52.231
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents