Description Of BigDecimal: hashCode()
The java.math.BigDecimal.hashCode() returns the hash code for this BigDecimal . Note that two BigDecimal objects that are numerically equal but differ in scale (like 2.0 and 2.00) will generally not have the same hash code.BigDecimal.hashCode() method returns hash code for this BigDecimal
Code Example Java BigDecimal
import java.math.BigDecimal; public class BigDecimalExam { public static void main(String[] args) { BigDecimal bg1 = new BigDecimal("25.00"); BigDecimal bg2 = new BigDecimal("25.00"); BigDecimal bg3 = new BigDecimal("25"); int b1 = bg1.hashCode(); int b2 = bg2.hashCode(); int b3 = bg3.hashCode(); System.out.println(b1); System.out.println(b2); System.out.println(b3); } }
ไม่มีความคิดเห็น :
แสดงความคิดเห็น