Integer
提供字符串,基本数据类型,对象之间得相互转化
包含每种基本数据类型得相关属性,如最大值,最小值

package mypro01; public class TestWrapper { public static void main(String[] args) { //自动装箱 autoboxing Integer a=1000;//自动装箱,编译器改进代码 Integer i=new Integer(1000); //自动拆箱 unboxing int b=a; //编译改进 a.intValue System.out.println(a); System.out.println(b); //[-128 127]之间得数据,仍然当基本数据类型来处理 Integer d=1234; Integer d1=1234; System.out.println(d==d1);//false System.out.println(d.equals(d1));//true Integer d3=123; Integer d4=123; System.out.println(d3==d4);//true System.out.println(d3.equals(d4));//true //输入最大值 System.out.println(Integer.MAX_VALUE); //字符串转化为数字 Integer.parseInt Integer i2=Integer.parseInt("234"); System.out.println(i2);//234 //对象转化为数字 intValue() Integer i3=new Integer("234"); System.out.println(i3.intValue());//234 } }
posted on 2020-03-07 14:03 happygril3 阅读(239) 评论(0) 收藏 举报
浙公网安备 33010602011771号