adding 2 BigDecimal values [duplicate]
BigDecimal is immutable. Every operation returns a new instance containing the result of the operation: BigDecimal sum = x.add(y); If you want x to change, you thus have to do x = x.add(y); Reading the javadoc really helps understanding how a class and its methods work.