Java Data Type Tutorial - 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 w ww .  jav  a 2s.  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.