In Java, we know if we want to compare two reference objects, we usually need to use equals
, but here I am so confused about the output of the following:
System.out.println(new BigInteger("0") == BigInteger.ZERO); // false
System.out.println(new BigInteger("0").mod(BigInteger.ONE) == BigInteger.ZERO); // true
Why is the second statement true?