import org.junit.Test;
public class day25Test {
public void mothod(Object object) {
System.out.println(object);
}
//单元测试
@Test
public void test3(){
//新特性
// jdk 5.0 的新特性 自动装箱 自动拆箱
//基本数据类型 --> 包装对象
int num =10;
mothod(num);
//自动装箱
Integer int1=num; // 会自动把基本数据变成对象
//自动拆箱
Integer integer =10;
int int2=integer; //自动拆箱
}
@Test
public void test4() {
//包装类 /基本数据类型--->String类型
int num3=10;
//方式一 链接运算
String string=num3+"";
//方式二
float f1=12.3f;
String string2=String.valueOf(f1);
System.out.println(string2);
//String类型 ---> 基本数据类型 或 包装类
String string3="123";
//使用强转的话 编译时不通过了 只有有子父类关系 才能使用强转
// int num1=(int)string3;
// Integer integer= (Integer)string3;
int int3=Integer.parseInt(string3);
//这个字符串就可以来运算了
System.out.println(int3+1);
String boolString ="true";
boolean bool=Boolean.parseBoolean(boolString);
System.out.println(bool);
}
}