Java BigDecimal.plus()

Syntax

BigDecimal.plus() has the following syntax.

public BigDecimal plus()

Example

In the following code shows how to use BigDecimal.plus() method.


/*from   ww w . ja  va2 s  .c  o  m*/
import java.math.BigDecimal;

public class Main {

  public static void main(String[] args) {

    BigDecimal bg1 = new BigDecimal("-123.126");

    BigDecimal bg2 = bg1.plus();

    System.out.println(bg2);
  }
}

The code above generates the following result.





















Home »
  Java Tutorial »
    java.math »




BigDecimal
BigInteger