BigDecimal.equals(Object x) has the following syntax.
public boolean equals(Object x)
In the following code shows how to use BigDecimal.equals(Object x) method.
/*from w w w . j av a 2s.c o m*/ import java.math.BigDecimal; public class Main { public static void main(String[] args) { BigDecimal bg1 = new BigDecimal("25.00"); BigDecimal bg2 = new BigDecimal("25.00"); BigDecimal bg3 = new BigDecimal("25"); // assign the result of equals method to b1, b2 Boolean b1 = bg1.equals(bg2); Boolean b2 = bg1.equals(bg3); System.out.println(b1); System.out.println(b2); } }
The code above generates the following result.