public class Work1 {
public static void main(String[] args) {
//1.构造方法–装箱
Integer i1 = new Integer(6);
Integer i2 = new Integer(“6”);
Double d1 =new Double(6.1);
Double d2 =new Double(“3.2”);
Boolean b = new Boolean(true);
Boolean b2 = new Boolean(“truE”);
Character c1 = new Character(‘c’);
//2.实例方法:xxxValue -- 拆箱
int i = i1.intValue();
Boolean b3 = b.booleanValue();
char c2 = c1.charValue();
//3.静态方法toString -- 基本类型 --> String
String s = Integer.toString(6);
String s2 = Double.toString(3.1);
//4.静态方法parsexxx String --> 基本类型
int i3 = Integer.parseInt("6");
Double d3 = Double.parseDouble("6.1");
Boolean b4 = Boolean.parseBoolean("true");
//5.静态方法valueOf -- 装箱
Integer i4 = Integer.valueOf(6);
Double d4 = Double.valueOf(3.6);
//6.静态方法:compare 比较,返回int
int m = Double.compare(3.6,5.6);
System.out.println(m);
}
}