172.16.0.151_20200828-陈政平
问题
public static void main(String[] args) {
// Decimal d = new Decimal( 100L ); // The constructor Decimal(long) is not visible
Decimal d = Decimal.valueOf( 1000L );
System.out.println( d );
Decimal e = Decimal.valueOf( 1000L );
System.out.println( e );
System.out.println( d == e ); // false
System.out.println( d.equals( e ) ); // true
}
System.out.println( d == e ); // false
上面的输出当d,e值为1000L时是false,为100时输出是true,在范围内的数字是存储在缓存中的,直接从缓存中拿,是因为超出了byte数组的范围时就会输出false吗?
吐槽
感觉对于细节的东西掌握的不是太清楚,有时候会混淆。
点赞