This is because of how java cache for auto-boxed integer values work. From Java Language Specification 5.1.7:
If the value p being boxed is an integer literal of type int between -128 and 127 inclusive (§3.10.1), or the boolean literal true or false (§3.10.3), or a character literal between '\u0000' and '\u007f' inclusive (§3.10.4), then let a and b be the results of any two boxing conversions of p. It is always the case that a == b.
And there is no such auto-boxing cache for Double class.
Войдите чтобы поставить Нравится
Войдите чтобы прокомментировать