package test_basic;
public class TestInteger2 {
public static void main(String[] args) {
/*System.out.println(Integer.MAX_VALUE);
System.out.println(Integer.MIN_VALUE);*/
//各种数据类型之间的转换
//int ---- Integer
//int--->Integer
int a=12;
Integer i1 = new Integer(a);
System.out.println(i1);
Integer i2=Integer.valueOf(a);//静态方法
System.out.println(i2);
//Integer---->int
int a2 = i2.intValue();
System.out.println(a2);
//String --- Integer
//String--->Integer
String str="123";
Integer i3 = new Integer(str);
System.out.println(i3);
Integer i4 = Integer.valueOf(str);
System.out.println(i4);
//Integer--->String
String s1=i4.toString();
System.out.println(s1);
String s2=i4+"";
System.out.println(s2);
//int ---- String
//int--->String
int a3=123;
String s3=a3+"";
System.out.println(s3);
//String--->int
String s4="1234 ";
int a4=Integer.parseInt(s4);
System.out.println(a4);
}
}
public class TestInteger2 {
public static void main(String[] args) {
/*System.out.println(Integer.MAX_VALUE);
System.out.println(Integer.MIN_VALUE);*/
//各种数据类型之间的转换
//int ---- Integer
//int--->Integer
int a=12;
Integer i1 = new Integer(a);
System.out.println(i1);
Integer i2=Integer.valueOf(a);//静态方法
System.out.println(i2);
//Integer---->int
int a2 = i2.intValue();
System.out.println(a2);
//String --- Integer
//String--->Integer
String str="123";
Integer i3 = new Integer(str);
System.out.println(i3);
Integer i4 = Integer.valueOf(str);
System.out.println(i4);
//Integer--->String
String s1=i4.toString();
System.out.println(s1);
String s2=i4+"";
System.out.println(s2);
//int ---- String
//int--->String
int a3=123;
String s3=a3+"";
System.out.println(s3);
//String--->int
String s4="1234 ";
int a4=Integer.parseInt(s4);
System.out.println(a4);
}
}