public class test22 { public static void main ( String [] args ){ int num = 5 ; Integer obj1 = new Integer ( num ); System . out . println ( "obj1的值为" + obj1 ); Integer obj2 = 100 ; System . out . println ( "obj2的值为" + obj2 ); I
public class test22 {
public static void main(String[] args){
int num=5;
Integer obj1=new Integer(num);
System.out.println("obj1的值为"+obj1);
Integer obj2=100;
System.out.println("obj2的值为"+obj2);
Integer obj3=new Integer("-789");
System.out.println("obj3的值为"+obj3);
System.out.println(Integer.BYTES);
System.out.println(Integer.MAX_VALUE);
System.out.println(Integer.MIN_VALUE);
System.out.println(Integer.SIZE);
//比较大小
System.out.println(obj2.compareTo(100));
System.out.println(obj2.compareTo(102));
System.out.println(obj2.compareTo(10));
//返回值类型
int num1=obj2.intValue();
System.out.println(num1);
//将一个字符串转换为int数据返回
int str1=Integer.parseInt("125");
System.out.println(str1+12);
}
}
运行结果