站长之家排行榜,电话销售做网站,给网站设置关键词,手机网站开发c全屏Java.math.BigDecimal.plus()方法实例java.math.BigDecimal.plus() 返回一个BigDecimal#xff0c;其值是 (this)#xff0c;并且其刻度为是 this.scale().这种方法#xff0c;它只是返回此BigDecimal是包括对称性与一元减号方法negate()。声明以下是java.math.BigDecim…全屏Java.math.BigDecimal.plus()方法实例java.math.BigDecimal.plus() 返回一个BigDecimal其值是 (this)并且其刻度为是 this.scale().这种方法它只是返回此BigDecimal是包括对称性与一元减号方法negate()。声明以下是java.math.BigDecimal.plus()方法的声明public BigDecimal plus()参数NA返回值此方法返回的对象的值即 this异常NA例子下面的例子显示math.BigDecimal.plus()方法的用法package com.yiibai;import java.math.*;public class BigDecimalDemo {public static void main(String[] args) {// create 2 BigDecimal ObjectsBigDecimal bg1, bg2;// assign value to bg1bg1 new BigDecimal(-123.126);// assign the result of plus method on bg1 to bg2bg2 bg1.plus();String str The value of the BigDecimal is bg2;// print the value of bg2System.out.println( str );}}让我们编译和运行上面的程序这将产生以下结果The value of the BigDecimal is -123.126分享到0评论