int转为Integer
public static void main(String[] args) {
int num=9;
Integer numIngeter=new Integer(num);
Integer numIngete2=Integer.valueOf(num);
System.out.println(numIngeter);
System.out.println(numIngete2);
}
Integer 转为int
public static void main(String[] args) {
Integer integer=new Integer(666);
int i=integer.intValue();
System.out.println(i);
}
字符串转 Integer
public static void main(String[] args) {
String string=new String("sa");
String string2=new String("666");
Integer integer2=Integer.valueOf(string2);
System.out.println(integer2);
}
字符串转int
String string=new String("5adkk");
String string1=new String("56666");
int num2=Integer.parseInt(string1);
System.out.println(num2);