java开发规范学习

from

慕课网-明明如月-《阿里巴巴的Java开发手册》

Integer缓存问题分析

1,
Integer缓存[-128, 127]的数字,除此之外,将通过new创建。
Long也是缓存 [-128, 127]
Short缓存[-128, 127]
Boolean缓存true, false
Character 缓存<=127

所以
Integer a=100,b=100,c=200,d=200;
System.out.println(ab); // true
System.out.println(c
d); // false, 需要使用equals进行比较

原文地址:https://www.cnblogs.com/hiluna/p/12327441.html