BigDecimal.add(BigDecimal augend) has the following syntax.
public BigDecimal add(BigDecimal augend)
In the following code shows how to use BigDecimal.add(BigDecimal augend) method.
/*w w w .ja v a 2 s . c o m*/ import java.math.BigDecimal; public class Main { public static void main(String[] args) { BigDecimal bg1 = new BigDecimal("12.345"); BigDecimal bg2 = new BigDecimal("20.123"); // print bg1 and bg2 value System.out.println("Object Value is " + bg1); System.out.println("Augend value is " + bg2); // perform add operation on bg1 with augend bg2 BigDecimal bg3 = bg1.add(bg2); // print bg3 value System.out.println("Result is " + bg3); } }
The code above generates the following result.