Method evaluates bigdecimal object values as well as the scales allocated to the values. Method returns true only when both bigdecimal objects as operands for the methods possess same value and same scale.
Method throws NumberFormatException if it value other than integer or double value.
In the example an string array with name rose is created. With this array two bigdecimal objects
neo & trinity are assigned number values.
Also an object of MathContext class is created for handling the rounding behavior of the values,
assigned to the bigdecimal objects.
Syntax for using the method: public boolean equal(Object x)
System.out.println(bigdecimal_objectName.equals(bigdecimal_objectName)));
or
boolean boo = (this.object).equals(x);
Java_BigDecimal_equal.java
import java.math.BigDecimal;
|
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.
Ask Questions? Discuss: Java BigDecimal equals example
Post your Comment