|
|
The java.math.BigDecimal.add(BigDecimal augend, MathContext mc) returns a BigDecimal whose price is (this + augend), with rounding according to the MathContext settings. If either number is zero and the precision placing is nonzero then the opposite number, rounded if essential, is used as the result.
Following is the declaration for java.math.BigDecimal.add() technique.
augend − Value to be added to this BigDecimal.
mc − The context to use.
This method returns a BigDecimal object whose value is this + augend, rounded as necessary
ArithmeticException − If the result is inexact but the rounding mode is UNNECESSARY.
The following example shows the usage of math.BigDecimal.add() method.
Let us compile and run the above program, this will produce the following result −
|
|
Java.math Package Related Tutorials |
|
---|---|
Adv Java Tutorial | Java Tutorial |
Java 8 Tutorial | Unittest Framework Tutorial |
Java.math Package Related Practice Tests |
|
---|---|
Adv Java Practice Tests | Java applet Practice Tests |
Java 8 Practice Tests |
All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.