public class Javatest73 {
/**
* 包装类
* 包装类和基本数据类型进行运算时,能够自动装箱或拆箱。
*/
public static void main(String[] args) {
int m = 6;
Integer n = new Integer(1);
int p = m + n;
//7
System.out.println(p);
int x=3;
Integer y = new Integer(3);
Integer z = new Integer(3);
//false
System.out.println(y==z);
//z在进行运算时,发生了自动拆箱,true
System.out.println(x==z);
Integer integer = new Integer(10);
//包装类作为参数传递时,是值传递,而非引用传递
test(integer);
//10
System.out.println(integer);
}
public static void test(Integer integer){
integer=666; // 修改为666
}
}