基本数据类型 --> 包装类
3 --> Integer.valueOf(3)
包装类 --> 基本数据类型
int i = integer.intValue()
自动装箱规范要求 boolean、byte、char 127, 介于 -128 ~ 127 之间的 short 和 int 被包装到固定的对象中。
基本数据类型 --> 字符串
- +""
- String s = Integer.toString(3);
- String s = String.valueOf(3);
字符串 --> 基本数据类型
- int i = Integer.parseInt(“3”);
- int i = Integer.valueOf(3); 自动拆箱