Java Math BigDecimal.plus() 方法


Java Math BigDecimal.plus() 方法

package com.codingdict;



import java.math.*;



public class BigDecimalDemo {



   public static void main(String[] args) {



      // create 2 BigDecimal Objects

      BigDecimal bg1, bg2;



      // assign value to bg1

      bg1 = new BigDecimal("-123.126");



      // assign the result of plus method on bg1 to bg2

      bg2 = bg1.plus();



      String str = "The value of the BigDecimal is " + bg2;



      // print the value of bg2

      System.out.println( str );

   }

}