Online Java Compiler By
JavaTpoint.com
import java.math.BigDecimal; import java.math.MathContext; public class BigDecimalEqualsExample2 { public static void main(String[] args) { // Create BigDecimal objects BigDecimal bdValue_1, bdValue_2; // Create boolean variable boolean equalStatus; //Assigning Values into BigDecimal objects bdValue_1 = new BigDecimal("45.0"); bdValue_2 = new BigDecimal("45.0"); // It will return boolean (true/false) equalStatus = bdValue_1.equals(bdValue_2); // Displaying result of equals method (true/false) System.out.println( " Are these two BigDecimal objects same? : " +equalStatus); } }
Output