Java BigDecimal equals() MethodThe equals() method of Java BigDecimal class is used to Compare this BigDecimal with the specified Object for equality. In this method, two BigDecimal objects are found to be equal if they are equal in value and scale. Note: 2.0 is not equal to 2.00 when compared by this method.Syntax:Parameter:x: Object to which this BigDecimal is to be compared. Exception:No Returns:It returns true if and only if the specified Object is a BigDecimal whose value and scale are equal to this BigDecimal. Example 1Test it NowOutput: Are these two BigDecimal objects same? : false Example 2Test it NowOutput: Are these two BigDecimal objects same? : true Example 3Test it NowOutput: These two BigDecimal objects are Not Same (False) Example 4Test it NowOutput: These two BigDecimal objects are Same (True) Next TopicJava BigDecimal |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India