1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

纠正4.3节中关于基本数据类型缓存的一点描述信息

This commit is contained in:
Rocky 2020-01-15 15:29:12 +08:00
parent 59bca95013
commit c7b982a17c

View File

@ -387,7 +387,7 @@ true
### 4.3 8 种基本类型的包装类和常量池
- **Java 基本类型的包装类的大部分都实现了常量池技术,即 Byte,Short,Integer,Long,Character,Boolean这 5 种包装类默认创建了数值[-128127] 的相应类型的缓存数据,但是超出此范围仍然会去创建新的对象。** 为啥把缓存设置为[-128127]区间?([参见issue/461](https://github.com/Snailclimb/JavaGuide/issues/461))性能和资源之间的权衡。
- **Java 基本类型的包装类的大部分都实现了常量池技术,即 Byte,Short,Integer,Long,Character,Boolean前面 4 种包装类默认创建了数值[-128127] 的相应类型的缓存数据Character创建了数值在[0,127]范围的缓存数据。如果对应范围仍然会去创建新的对象。** 为啥把缓存设置为[-128127]区间?([参见issue/461](https://github.com/Snailclimb/JavaGuide/issues/461))性能和资源之间的权衡。
- **两种浮点数类型的包装类 Float,Double 并没有实现常量池技术。**
```java