Intger int
- 装箱
基本数据类型 ----》 包装类
构造方法:
public Integer(int n);
Integer n = new Integer(int n);
Integer的静态方法static Integer valueOf(int n)
Integer n = Integer.valueOf(int n) - 拆箱
包装类-----》基本数据类型
int intValue();
int n = 对象名.intValue(); - JDK1.5自动拆箱、自动封箱
int n = 123;
Integer m = n; // 自动封箱
int o = m; // 自动拆箱 - 基本数据类型和字符串之间的转换
基本数据类型 ------》 字符串
1. 字符串 = 基本数据类型 + “”;
2. Integer静态方法static String toString(参数)
String s = Integer.toString(int n)
3. String的静态方法static String valueOf(int n)
String s = String.valueOf(int n);
字符串 ----》基本数据类型
包装类中的静态方法:static int parseXxx(String s)
int n = Integer.parseInt(String s);