Description Of BigDecimal: subtract(BigDecimal subtrahend)
The java.math.BigDecimal.subtract(BigDecimal subtrahend) returns a BigDecimal whose value is (this - subtrahend) , and whose scale is max(this.scale(), subtrahend.scale()).BigDecimal.subtract(BigDecimal subtrahend) method returns this - subtrahend
Code Example Java BigDecimal
import java.math.BigDecimal;
public class BigDecimalExam {
public static void main(String[] args) {
BigDecimal bg1 = new BigDecimal("123.123");
BigDecimal bg2 = new BigDecimal("12.12");
BigDecimal bg3 = bg1.subtract(bg2);
// print bg3 value
System.out.println(bg3);
}
}
ไม่มีความคิดเห็น :
แสดงความคิดเห็น