public class Test6 {
public static void main(String[] args) {
//String 与基本数据类型转换,包装类转换的问题
//1.把一个字符串装换成包装类(必须是数字)
Integer i = new Integer("12");
System.out.println(i);
//把包装类转换成字符串
Integer j = 100; //Integer.valueOf(100);等价
Integer j2 = new Integer(j);
String j3 = j2.toString();
System.out.println(j3);
//基本数据类型装换陈字符串,直接在后面+ ""
int a = 10;
String str = a + "";
System.out.println(a);
String Str = "200";
double k = Double.parseDouble(Str);
System.out.println(k);
//字符串转boolean 除了true 其他全部转换成false
Boolean b = new Boolean("a");
System.out.println(b);
}
}