I am having following code, however I am not able to understand why the two bigdecimal are not considered as equal
class Ideone
{
public static void main (String[] args) throws java.lang.Exception
{
BigDecimal b = new BigDecimal(13.90);
BigDecimal b2 = new BigDecimal("13.9");
System.out.println(b.compareTo(b2));
}
}
This code outputs 1 as output. Why would that be the case? Shouldn't it be 0?
Also if I write 13.9 instead of "13.9" it gives 0 as output